Multiple conditions

G

Guest

I have a number of different conditions which yield the same result. I tried
(what I thought was) a straightforward IIF statement

IIF ( [ABC List] like ( "AB*" or "CD*" or "EF*" ), "ABC","")

But that didn't give me results. (When any of those conditions was met, I
got a blank.) So instead I did the following.

IIF ( [ABC List] like "AB*", "ABC", IIF ( [ABC List] like "CD*", "ABC", IIF
( [ABC List] like "EF*", "ABC","")))

This works, but it's very unwieldy. Is there a way to construct the query
more like the first one above?
 
G

Guest

Instead of the nested iif, use the criteria with Or

IIF([ABC List] like "AB*" Or [ABC List] like "CD*" Or [ABC List] like
"EF*" , "ABC","")
 
G

Guest

Thanks so much Ofer and Shabbat Shalom!

David

Ofer Cohen said:
Instead of the nested iif, use the criteria with Or

IIF([ABC List] like "AB*" Or [ABC List] like "CD*" Or [ABC List] like
"EF*" , "ABC","")

--
Good Luck
BS"D


David Gerstman said:
I have a number of different conditions which yield the same result. I tried
(what I thought was) a straightforward IIF statement

IIF ( [ABC List] like ( "AB*" or "CD*" or "EF*" ), "ABC","")

But that didn't give me results. (When any of those conditions was met, I
got a blank.) So instead I did the following.

IIF ( [ABC List] like "AB*", "ABC", IIF ( [ABC List] like "CD*", "ABC", IIF
( [ABC List] like "EF*", "ABC","")))

This works, but it's very unwieldy. Is there a way to construct the query
more like the first one above?
 
G

Guest

Shabat Shalom

--
Good Luck
BS"D


David Gerstman said:
Thanks so much Ofer and Shabbat Shalom!

David

Ofer Cohen said:
Instead of the nested iif, use the criteria with Or

IIF([ABC List] like "AB*" Or [ABC List] like "CD*" Or [ABC List] like
"EF*" , "ABC","")

--
Good Luck
BS"D


David Gerstman said:
I have a number of different conditions which yield the same result. I tried
(what I thought was) a straightforward IIF statement

IIF ( [ABC List] like ( "AB*" or "CD*" or "EF*" ), "ABC","")

But that didn't give me results. (When any of those conditions was met, I
got a blank.) So instead I did the following.

IIF ( [ABC List] like "AB*", "ABC", IIF ( [ABC List] like "CD*", "ABC", IIF
( [ABC List] like "EF*", "ABC","")))

This works, but it's very unwieldy. Is there a way to construct the query
more like the first one above?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top