Miltiple IF Statement

Msgjazz

New Member
Joined
Oct 21, 2003
Messages
45
Default Re: using INDIRECT with VLOOKUP




Thank you all for your help. I've been out for a while. I have a different question. I'm trying to do a multiple IFS statement where it matches two cell in cell BF4

Sample File Link

So IF A2 (ENF) matches C1 (ENF) and B2 matches anything in G2-G7 (HELB, HOCS...) than I should get a 1, otherwise 0.

Thanks
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
How about this:

=IF(AND(A2=C1,ISNUMBER(MATCH(B2,G2:G7,0))),1,0)

?
 
Upvote 0
Solution
Hi,

Another way, in C2 copied down:

=--AND(A2=C$1,COUNTIF(G$2:G$7,B2))

***You need to re-enter your C1 "ENF", you have either a leading or trailing space, =LEN(C1) returns 4
 
Last edited:
Upvote 0
jtakw

:)That worked. Thanks. Yes, there was a leading space.

Question.... What is the purpose of the leading hyphens. Can you explain that to me?
 
Last edited:
Upvote 0
jtakw

:)That worked. Thanks. Yes, there was a leading space.

Question.... What is the purpose of the leading hyphens. Can you explain that to me?

AND() by itself returns TRUE or FALSE. The leading -- coerces the TRUE/FALSE to show as 1 or 0 instead. (your desired results)

dreid1011

:) This worked. I forgot about the MATCH. Thanks

And you're welcome. Glad it worked for you.
 
Last edited:
Upvote 0
jtakw

:)That worked. Thanks. Yes, there was a leading space.

Question.... What is the purpose of the leading hyphens. Can you explain that to me?

You're welcome, glad it works for you.

Looks like dreid already answered your question, the double negative ( -- ) converts TRUE to 1, FALSE to 0, you can also use +0, or *1, the N() Function also does the same.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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