If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Multiple IIF Statements
I have a table that contains Company 1,2,...5 in seperate columns. In my
report I want to show the following: If Company 5 is "", company4, if company 4 is "" company 3....etc..... How do I do this? |
#2
|
|||
|
|||
Multiple IIF Statements
Try something like
=IIf([Company5] "" And [Company5] Is Not Null,[Company5], IIf([Company4] "" And [Company4] Is Not Null,[Company4], IIf([Company3] "" And [Company3] Is Not Null,[Company3],IIf([Company2] "" And [Company2] Is Not Null,[Company2],[Company1])))) -- Good Luck BS"D "2Blessed4Stress" wrote: I have a table that contains Company 1,2,...5 in seperate columns. In my report I want to show the following: If Company 5 is "", company4, if company 4 is "" company 3....etc..... How do I do this? |
#3
|
|||
|
|||
Multiple IIF Statements
I would seriously look at normalizing your table structure.
However, if the fields are actually Null and not a zero-length-string (""), you can use: =Nz([Company 5], Nz([Company 4], Nz([Company 3], Nz([Company 2], [Company 1]) ) ) ) -- Duane Hookom MS Access MVP "2Blessed4Stress" wrote in message ... I have a table that contains Company 1,2,...5 in seperate columns. In my report I want to show the following: If Company 5 is "", company4, if company 4 is "" company 3....etc..... How do I do this? |
#4
|
|||
|
|||
Multiple IIF Statements
Thanks! It works great.
"Ofer Cohen" wrote: Try something like =IIf([Company5] "" And [Company5] Is Not Null,[Company5], IIf([Company4] "" And [Company4] Is Not Null,[Company4], IIf([Company3] "" And [Company3] Is Not Null,[Company3],IIf([Company2] "" And [Company2] Is Not Null,[Company2],[Company1])))) -- Good Luck BS"D "2Blessed4Stress" wrote: I have a table that contains Company 1,2,...5 in seperate columns. In my report I want to show the following: If Company 5 is "", company4, if company 4 is "" company 3....etc..... How do I do this? |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Multiple If/Or Statements | scolbert | Worksheet Functions | 3 | April 24th, 2006 09:56 PM |
combining IF and AND statements for multiple columns | cubsfan | General Discussion | 2 | April 7th, 2006 05:25 PM |
MULTIPLE 'IF' statements | Luther | Running & Setting Up Queries | 3 | September 2nd, 2004 04:20 PM |
Multiple IF/THEN statements? | ehinkley | Mailmerge | 1 | May 17th, 2004 04:13 PM |
Multiple SUMIF Statements | Gary Thomson | Worksheet Functions | 4 | October 28th, 2003 11:16 AM |