IIf and statement in MS Query

confused.co.uk

New Member
Joined
Aug 11, 2010
Messages
1
Hoping someone can help me. I am using MS Query to pull data in from an Access DB. I need to create a excel equivalent 'If AND' statement in ms query.

iif(and([CLCall]=1,[CLCall]=2),1,0)

But get a syntax error each time.
What am I doing wrong, pls help....
 

Some videos you may like

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Fazza

MrExcel MVP
Joined
May 17, 2006
Messages
9,368
Code:
'The value can never be 1 and 2. So, the logic isn't right.
 
'The syntax could be,
iif(CLCall = 1 AND CLCall = 2, 1, 0) AS [Resultant Field Name]
 
'Or maybe you want OR?
iif(CLCall = 1 OR CLCall = 2, 1, 0) AS [whatever]
 

Watch MrExcel Video

Forum statistics

Threads
1,102,552
Messages
5,487,524
Members
407,604
Latest member
sama9000

This Week's Hot Topics

Top