Query Question

AcceSs-AbLe

Board Regular
Joined
Jan 27, 2003
Messages
87
Hi,

I am trying to run this query, the first set of If statements produce a result, however the second set of if statements appear to be doing nothing.

CREDIT: IIf([URVALUE]>0,IIf([Account]=5303020001,"C",IIf([Account]=1003050000,"D",IIf([URVALUE]<0,IIf([Account]=1003050000,"C",IIf([Account]=5303020002,"D"))))))

**It works fine until it goes to [URVALUE]<0

How can I amend the query so that all the statements would work.

Thank you!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
I am not totaly sure but it looks as if there is no false part to [URVALUE]<0 So if [URVALUE] = 0 then nothing will happen.
you could try [URVALUE]<=0 and see if that works or you may need to trap the 0 value seperatlely.

HTh

Peter
 
Upvote 0
I assume that you mean it is returning a blank. I would try breaking it down further just to test what is actualy happening then build it back up instages

CREDIT: IIf([URVALUE]>0,IIf([Account]=5303020001,"C",IIf([Account]=1003050000,"D",IIf([URVALUE]<0,"C","D"))))

HTH

Peter
 
Upvote 0
I used the statement you provided and it produces results for all outputs >0, however, it i see blanks for anything <0 , would it be possible to use two different columns and then combine the results somehow?
 
Upvote 0
If you do it in two columns Credit1, Credit2 then you could combine them in a third with Credit:[Credit1] & [Credit2]

HTH

Peter
 
Upvote 0
Thanks Peter, this worked out perfectly. one more question, I have two queries that produce different results, I want to combine both queries and have a third query produce results of both queries. Is this possible?
 
Upvote 0
if they both have the same fields the you can use a Union Query.

Look it up in help

Peter
 
Upvote 0

Forum statistics

Threads
1,221,558
Messages
6,160,484
Members
451,651
Latest member
Penapensil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top