Iif

Local time
Today, 08:18
Joined
Jul 13, 2011
Messages
28
How do I combine these two codes so that they will work

Abs(Sum([Won Home]+[Won Away]))
iif(isnull(score3),score1,score1+score3)
 
Are you trying to add them together? Subtract one from the other? Please elaborate... And what issues are you having when you do so?
 
This is the best way i can explain it

Hi I wounder if someone could help me in this issue that I have

I have four fields called the following

Score 1 score 2 Score 3 and Score 4

I run a query to add up score 1 and score 3 to give me a plus total with the following statment

Abs(Sum([Score 1]+[Score 3]))

The problem I am having is if the player who has scored in score 1 & 2 has did not play for a score to be registed in 3 and 4 i need an iff statment to show the following
Abs(Sum([Score 1]+[Score 3])) if score 3= blank (no data entered) then just add Score 1

Example Below

Score 1 = For 21 Score 2 -10 against Score 3=0 as player did not play

So total score for shoud show 21 then if he played another home game and wins 21 again and misses the asway game the iff statment should then add the two 21s together.

Hope this make sense


if(isnull(score3),score1,score1+score3)

The above sounds like what you were trying to describe earlier.. I didn't quite understand all of your explanation; however, the above statement basically says:

if the field "score3" is null then use "score1", but if "score3" not null then use "score1" plus "score 3"

BTW 'iif' stands for 'Immediate IF'. That how you can remember that it iif not iff.

Hope that helps,
Goh

I just need to combine the two codes as per prevous post
 
I still don't understanding the combining...

Code:
IIf(IsNull(score3) OR score3 = "",score1,score1+score3)

OR

Code:
If IsNull(score3) OR score3 = "",score1,score1+score3

Where does...

Code:
Abs(Sum([Won Home]+[Won Away]))

...get added to?
 
I'm thinking the issue you have is when you add two fields where one is a null, the answer is always null. If this is the case, read up about the NZ function
 

Users who are viewing this thread

Back
Top Bottom