How to use IF statements in query

Ben2k

Board Regular
Joined
Oct 16, 2002
Messages
77
I have a query with a field called "VatQualifying", the value of this is always either 0 or 1 i.e. yes or no

If it is 0 I want my query to display "No" instead of 0
If it is 1 I want it to display "Yes" instead of 1

How can I do it?

Thanks

Ben
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Try this

Iif([VatQualifying], "Yes", "No")

BTW

Does VatQualifying come from a table? If so you could change it's data type to Yes/No.
 
Upvote 0
Yes comes from a table however its a linked paradox table so unable to change data type.

Just noticed as well the values or 0 for No and -1 for Yes, will your expression still work?

Cheers

Ben
 
Upvote 0
As far as I know it should.

Syntax for IIf is

IIf([Expression], X, Y)

means

if Expression is True return X
if Expression is False return Y

Access regards -1 as True and 0 as False.
 
Upvote 0

Forum statistics

Threads
1,221,783
Messages
6,161,913
Members
451,730
Latest member
BudgetGirl

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