Skip to main content
Solved

Variable Style IIF Expression


Forum|alt.badge.img

I have a slightly weird question.

Can I have multiple IIF expressions within one field?

 

It seems possible, but I am not sure how to accomplish this.

 

I would like to change the cell style based on the text inside of it.

 

But the system does not like me adding another IIF statement within my expression.

 

This is what I have right now to keep it simple, but once I can get it to work, I will add a couple more colors.

 

=IIf( [InventoryItem.PreferredVendorID]='100045', 'purple20', 'default') OR

IIf( [InventoryItem.PreferredVendorID]='100351', 'yellow20',' default') 

 

 

The System doesn’t like my OR placement, does anyone know a better way to do this?

Best answer by davidnavasardyan

Hi ​@bodiec 

You can absolutely use multiple IIf statements, but you’ll need to nest them properly—no OR between them. Try this structure instead:

=IIf([InventoryItem.PreferredVendorID]='100045', 'purple20', 
 IIf([InventoryItem.PreferredVendorID]='100351', 'yellow20', 
 'default'))

Just keep stacking them like that if you need more conditions. It’s basically like a fancy "else if" chain.

View original
Did this topic help you find an answer to your question?

3 replies

lauraj46
Captain II
Forum|alt.badge.img+8
  • Captain II
  • 604 replies
  • April 15, 2025

Hi ​@bodiec ,

You can nest the IIf statements, but easiest is to use Switch instead, something like this:

=switch( [InventoryItem.PreferredVendorID]='100045', 'purple20',  [InventoryItem.PreferredVendorID]='100351', 'yellow20', 1=1, 'default') 

Hope this helps!

Laura


davidnavasardyan
Jr Varsity I
Forum|alt.badge.img+3

Hi ​@bodiec 

You can absolutely use multiple IIf statements, but you’ll need to nest them properly—no OR between them. Try this structure instead:

=IIf([InventoryItem.PreferredVendorID]='100045', 'purple20', 
 IIf([InventoryItem.PreferredVendorID]='100351', 'yellow20', 
 'default'))

Just keep stacking them like that if you need more conditions. It’s basically like a fancy "else if" chain.


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 33 replies
  • April 15, 2025

Thank you both very much!

@davidnavasardyan ​@lauraj46 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings