IIf Function

  • Thread starter Thread starter Jack Houck
  • Start date Start date
J

Jack Houck

Hello,

How can you include mutiple comparisons with an IIf function?

I want my query to look at the first 2 spaces and if it
equals 01, then put "01", but if not then put " ". That
part is easily done

(My example: IIf(Mid([q05],1,2)=1,"01"," "))

What I need it to do next is look at the next two spaces
<example: Mid([q05],3,2) > and if it equals 02 then put
"02", or if not " ".

Thanks in advance,
Jack
 
Hi Jack,

Sure! It's called a nested IIF:

IIF(Mid([q05],1,2)=1,"01",IIF([Mid([q05],3,2)=2,"02"," "))

hth,

LeAnne
 
Perfect, Thank you very much.
-----Original Message-----
Hi Jack,

Sure! It's called a nested IIF:

IIF(Mid([q05],1,2)=1,"01",IIF([Mid([q05],3,2)=2,"02"," "))

hth,

LeAnne

Jack said:
Hello,

How can you include mutiple comparisons with an IIf function?

I want my query to look at the first 2 spaces and if it
equals 01, then put "01", but if not then put " ". That
part is easily done

(My example: IIf(Mid([q05],1,2)=1,"01"," "))

What I need it to do next is look at the next two spaces
<example: Mid([q05],3,2) > and if it equals 02 then put
"02", or if not " ".

.
 
Back
Top