Formula not working, work around?

Camel123

Board Regular
Joined
Jun 5, 2018
Messages
186
Hi,

=IF(A1={77;88;99}&" *";"OK";"")

A1 cell value= 77 Hamburger

Why does the formula return FALSE and not TRUE? :oops:

Appreciate your input.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
try

=IF(SUMPRODUCT(--(ISNUMBER(SEARCH({77;88;99},A1))))>0;"OK";"")
 
Upvote 0
Worked perfect! Thank you mate. Just to understand, the two hyphen "--" just before (ISNUMBER...), not familiar with this, what purpose does it fulfill? if I remove them the formula stops working.
 
Upvote 0
Worked perfect! Thank you mate. Just to understand, the two hyphen "--" just before (ISNUMBER...), not familiar with this, what purpose does it fulfill? if I remove them the formula stops working.

you're welcome
the -- convert the true/false in an array to 1/0 etc so that the sumproduct() can works on it
 
Upvote 0
Now it is more clear to me regarding that. Though, I am a bit confused about using the =sumproduct in this context. What it usually does it multiplying one array with another and returns the product of those values, as far as I understand. In this context I can not really see what it does. Can you explain?
 
Upvote 0
i'm sure there is other way round.

anyway, the search() function try to find if any match of 77, 88 & 99 within Cell A1
and the isnumber() will convert them into ture or false,
the -- convert them into 1 and 0.

the sumproduct() add them together if one or more match (1 or above)
 
Upvote 0
Based on your first formula you want the cell to start with 77, 88, or 99 and then a space which the provided formula doesnt strictly do. You could try:

=IF(OR(--(ISNUMBER(SEARCH({77;88;99}&" ",LEFT(A1;3)))));"OK";"")
 
Upvote 0
Thanks!

I modified the formula and added "AND" since I want a second criteria:

=IF(SUMPRODUCT(--(AND(ISNUMBER(SEARCH({77;88;99},A1))))>0;"OK";"")

When 77 does not exist in A1 the formula evaluation display "FALSE;FALSE...." which is correct, when clicking next step, all "FALSE" turns to "TRUE", why?
 
Upvote 0
what's the 2nd criteria for the AND() function?
 
Upvote 0
Second criteria is=
B1<=0

It returns FALSE on whether A1 contains 77 or not, and since B1= -100 the second criteria is TRUE, the whole AND turns "TRUE" because the "FALSE" later turns to "TRUE".
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,825
Members
449,096
Latest member
Erald

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