Array formula

Sony2011

New Member
Joined
Jun 7, 2011
Messages
7
dear

I created a formula that if A1 match any one in the range, then return me yes; else, no.

But, it seems the formula only refers to cell B1 only, instead of the data in the range (B1:B5). it means only if B1 = apple, then the formula works and return me, Yes. What's wrong? I have done the CTRL+SHIFT+ENTER to bracket the array. but it does not help Please help

=if(A1=$B$1:$B$5,"yes","no")

A1 = apple

B1= orange
B2 = grape
B3 = apple
B4 = pears
B5 = banana

Problem, Thank you
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Welcome to the board...

You can't compare one cell to Several Other cells with just a simple IF like that..

Try Countif..

=IF(COUNTIF($B$1:$B$5,A1)>0,"yes","no")

Hope that helps.
 
Upvote 0
Also, even though this may seem more complicated, it will actually be more efficient..

=IF(ISNUMBER(MATCH(A1,$B$1:$B$5,0)),"yes","no")


This is more efficient because Countif must evaluate EVERY cell in $B$1:$B$5,
While Match only has to evaluate cells untill it finds what it's looking for, then it stops.
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,916
Members
452,949
Latest member
beartooth91

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