ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   testing for left 2 characters in set of 3 choices (https://www.excelbanter.com/excel-worksheet-functions/253791-testing-left-2-characters-set-3-choices.html)

musicman

testing for left 2 characters in set of 3 choices
 
following returns true even if false
a1=ab1234
b1=if(left A1,2)=or("cd","ef","gh"),1,2) test if A1=cd or ef or gh, true
1, false 2
the above should return 2 false but returns 1 true in error?
I tried formula evaluation and it shows "ab"=false but then evalutes
combined to true in error.

Gary''s Student

testing for left 2 characters in set of 3 choices
 
=IF(OR(LEFT(A1,2)={"cd","ef","gh"}),1,2)

--
Gary''s Student - gsnu200909

Eduardo

testing for left 2 characters in set of 3 choices
 
Hi,
=IF(OR(LEFT(A1,2)="cd",LEFT(A1,2)="ef",LEFT(A1,2)= "gh"),1,2)

"MusicMan" wrote:

following returns true even if false
a1=ab1234
b1=if(left A1,2)=or("cd","ef","gh"),1,2) test if A1=cd or ef or gh, true
1, false 2
the above should return 2 false but returns 1 true in error?
I tried formula evaluation and it shows "ab"=false but then evalutes
combined to true in error.


Ms-Exl-Learner

testing for left 2 characters in set of 3 choices
 
Use your formula like the below:-

=IF(OR(LEFT(A1,2)="CD",LEFT(A1,2)="EF",LEFT(A1,2)= "GH"),"TRUE 1","FALSE 2")

Remember to Click Yes, if this post helps!

--------------------
(Ms-Exl-Learner)
--------------------


"MusicMan" wrote:

following returns true even if false
a1=ab1234
b1=if(left A1,2)=or("cd","ef","gh"),1,2) test if A1=cd or ef or gh, true
1, false 2
the above should return 2 false but returns 1 true in error?
I tried formula evaluation and it shows "ab"=false but then evalutes
combined to true in error.


David Biddulph[_2_]

testing for left 2 characters in set of 3 choices
 
You'll need to show us exactly what is in your formulae, and explain more
clearly what your problem is.

=if(left A1,2)=or("cd","ef","gh"),1,2) would not be a valid formula, as the
parentheses don't match.
When you've sorted out the parentheses, you've still got =OR("cd","ef","gh")
which is feeding text strings into a function that wants Boolean inputs, so
it gives a #VALUE! error.

Start again, but this time be more precise with the wording of your
question.
--
David Biddulph

"MusicMan" wrote in message
...
following returns true even if false
a1=ab1234
b1=if(left A1,2)=or("cd","ef","gh"),1,2) test if A1=cd or ef or gh, true
1, false 2
the above should return 2 false but returns 1 true in error?
I tried formula evaluation and it shows "ab"=false but then evalutes
combined to true in error.




Teethless mama

testing for left 2 characters in set of 3 choices
 
=AND(LEFT(A1,2)<{"cd","ef","gh"})+1


"MusicMan" wrote:

following returns true even if false
a1=ab1234
b1=if(left A1,2)=or("cd","ef","gh"),1,2) test if A1=cd or ef or gh, true
1, false 2
the above should return 2 false but returns 1 true in error?
I tried formula evaluation and it shows "ab"=false but then evalutes
combined to true in error.



All times are GMT +1. The time now is 12:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com