Multiple IIF statements

Equine Investor

Board Regular
Joined
Nov 20, 2002
Messages
103
I have a table with SEX of horses denoted as g (for gelding), c (for colt), f (for filly) etc etc.

I have a combo box linked to a query and this is what I have as my query syntax.

Like IIf([Forms]![SEARCH]![Combo410]="","*",IIf([Forms]![SEARCH]![Combo410]="Colts","c",IIf([Forms]![SEARCH]![Combo410]="Fillies","f",IIf([Forms]![SEARCH]![Combo410]="Geldings","g",IIf([Forms]![SEARCH]![Combo410]="Horses","h",IIf([Forms]![SEARCH]![Combo410]="Mares","m"))))))

This all works fine BUT I would like to add other criteria to the drop down list suchs as "Fillies and Mares" and "Colts, Geldings and Horses" so that the query would include BOTH or ALL these values.

Could someone please suggest a solution so that if "Colts, Geldings and Horses" were selected, then the combo box query would search for "c", "g" AND "h".

I'm at my wits end!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,221,621
Messages
6,160,879
Members
451,675
Latest member
Parlapalli

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top