A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

IIf



 
 
Thread Tools Display Modes
  #1  
Old February 19th, 2010, 09:41 AM posted to microsoft.public.access.queries
kevcar40
external usenet poster
 
Posts: 115
Default IIf

Hi
i have a crosstab query that takes values from 2 tables
table one weekly prod scores (entered weekly)
table two takes scrap numbers (entered daily)

the values are divided to create a percentage loss
using
1per:Sum((rejectreason_baseweeklysum.sumof1/
[rejectreason_baseweeklysum Query].wk1))

problem is when the scrap is entered the formula returns 100% because
there is no prod figure

i would like to use an iif statement to check if result is 100% if it
is make it null
ie
1per:iif(Sum((rejectreason_baseweeklysum.sumof1/
[rejectreason_baseweeklysum Query].wk1))= 100, "",
1per:Sum((rejectreason_baseweeklysum.sumof1/
[rejectreason_baseweeklysum Query].wk1))))

is this the correct thing to do
and is my syntax correct

thanks

kevin
  #2  
Old February 19th, 2010, 01:59 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default IIf

You should probably check for 1 (100%) and not 100 (10,000%) and you should
return Null instead of "" (a zero-length string). If you return the string
then all the values returned for 1per are going to be strings even though the
strings would consist of number characters.

Also, you seem to have an extra closing parenthesis and you should not include
"lper:" inside the expression.

1per:iif(Sum((rejectreason_baseweeklysum.sumof1/
[rejectreason_baseweeklysum Query].wk1))= 1, Null,
Sum((rejectreason_baseweeklysum.sumof1/
[rejectreason_baseweeklysum Query].wk1)))

I'm not sure that the above will give you the expected results, but then I am
not sure what you are trying to calculate.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

kevcar40 wrote:
Hi
i have a crosstab query that takes values from 2 tables
table one weekly prod scores (entered weekly)
table two takes scrap numbers (entered daily)

the values are divided to create a percentage loss
using
1per:Sum((rejectreason_baseweeklysum.sumof1/
[rejectreason_baseweeklysum Query].wk1))

problem is when the scrap is entered the formula returns 100% because
there is no prod figure

i would like to use an iif statement to check if result is 100% if it
is make it null
ie
1per:iif(Sum((rejectreason_baseweeklysum.sumof1/
[rejectreason_baseweeklysum Query].wk1))= 100, "",
1per:Sum((rejectreason_baseweeklysum.sumof1/
[rejectreason_baseweeklysum Query].wk1))))

is this the correct thing to do
and is my syntax correct

thanks

kevin

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.