A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Multiple IIF Statements



 
 
Thread Tools Display Modes
  #1  
Old May 8th, 2006, 10:02 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default 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  
Old May 8th, 2006, 11:05 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default 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  
Old May 9th, 2006, 02:52 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default 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  
Old May 9th, 2006, 02:02 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 05:50 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.