IF AND Contians/IN

rsj88

New Member
Joined
Feb 20, 2018
Messages
38
Hi i have the below which works

IF(AND(Table1[Colour]="Red",Table1[Car]="Audi"),1,0)

I need add more criteria to the formula. eg:

IF(AND(Table1[Colour]="Red","Blue","Green",Table1[Car]="Audi","BMW"),1,0)

How would i rewrite the above?

Thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi rsj88,

If you are looking for a DAX solution ("new column"), then you can try the following measure:

Rich (BB code):
AndMeasure = IF(TableRank[Name] IN {"Tim","Dave","Jen"} && 'TableRank'[Group] IN {"A","Z"},1,0)

1589829415448.png


So, in your case, it'd be:

Rich (BB code):
AndMeasure = IF(Table1[Colour] IN {"Red","Blue","Green"} && 'Table1'[Car] IN {"Audi","BMW"},1,0)
 
Upvote 0
Hi,

The above does not mark "A single value for column cannot be Determined" error

Thanks
 
Upvote 0
Hi,

You need to use "New column" instead of "New measure" in order to retain a row context -

1589879026949.png


If you use my formula in "New measure" then you'll get the "A single value cannot be determined" error.

However, if you need to build a "New measure", then you need to use some sort of aggregator to make sure that the measure always returns one single value, e.g. SUM or MAX. If that's the case, it would help to paste some screenshots to show what exactly you are trying to achieve (e.g. are you going to use this measure in a table or on a chart, how this visualizaiton looks like, is it affectedb y some filters?).
 
Upvote 0

Forum statistics

Threads
1,223,793
Messages
6,174,624
Members
452,575
Latest member
Fstick546

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