IF statement that compares first two characters to a FAIL list, and displays PASS or FAIL

IamJAMES

New Member
Joined
Aug 28, 2018
Messages
1
[FONT=&quot]I need help building a function that....[/FONT]
[FONT=&quot]If the number starts with: 06, 10, 63, 71, 91 That row FAILS![/FONT]
[FONT=&quot]Example: (Wont let me upload photo)[/FONT]
[FONT=&quot]​[/FONT]
[TABLE="class: s570a4-19 MzlEq"]
<thead style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline;">[TR="class: s570a4-20 bKSoXW, bgcolor: rgba(255, 255, 255, 0.8)"]
[TH="class: s570a4-25 eCDbZz, align: center"]NUMBERS:[/TH]
[TH="class: s570a4-25 eCDbZz, align: center"]First Two Characters:[/TH]
[TH="class: s570a4-25 eCDbZz, align: center"]PASS/FAIL:[/TH]
[/TR]
</thead><tbody style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline;">[TR="class: s570a4-20 bKSoXW, bgcolor: rgba(255, 255, 255, 0.8)"]
[TD="class: s570a4-21 fyFZeq"]06239808723[/TD]
[TD="class: s570a4-21 fyFZeq"]06[/TD]
[TD="class: s570a4-21 fyFZeq"]FAIL[/TD]
[/TR]
[TR="class: s570a4-20 bKSoXW, bgcolor: rgba(255, 255, 255, 0.8)"]
[TD="class: s570a4-21 fyFZeq"]21328947982[/TD]
[TD="class: s570a4-21 fyFZeq"]21[/TD]
[TD="class: s570a4-21 fyFZeq"]PASS[/TD]
[/TR]
[TR="class: s570a4-20 bKSoXW, bgcolor: rgba(255, 255, 255, 0.8)"]
[TD="class: s570a4-21 fyFZeq"]10298472498[/TD]
[TD="class: s570a4-21 fyFZeq"]10[/TD]
[TD="class: s570a4-21 fyFZeq"]FAIL[/TD]
[/TR]
[TR="class: s570a4-20 bKSoXW, bgcolor: rgba(255, 255, 255, 0.8)"]
[TD="class: s570a4-21 fyFZeq"]29879229298[/TD]
[TD="class: s570a4-21 fyFZeq"]29[/TD]
[TD="class: s570a4-21 fyFZeq"]PASS[/TD]
[/TR]
[TR="class: s570a4-20 bKSoXW, bgcolor: rgba(255, 255, 255, 0.8)"]
[TD="class: s570a4-21 fyFZeq"]63839743993[/TD]
[TD="class: s570a4-21 fyFZeq"]63[/TD]
[TD="class: s570a4-21 fyFZeq"]FAIL[/TD]
[/TR]
[TR="class: s570a4-20 bKSoXW, bgcolor: rgba(255, 255, 255, 0.8)"]
[TD="class: s570a4-21 fyFZeq"]29874982749[/TD]
[TD="class: s570a4-21 fyFZeq"]29[/TD]
[TD="class: s570a4-21 fyFZeq"]PASS[/TD]
[/TR]
</tbody>[/TABLE]
[FONT=&quot]​[/FONT]
[FONT=&quot]​I used this function to find the first to characters:=LEFT(A2,2)[/FONT]
[FONT=&quot]​[/FONT]
[FONT=&quot]I tried this function, to display pass or fail, but didn't work:[/FONT]
[FONT=&quot]=IF(AND(B2="06", B2="10", B2="63", B2="71", B2="91"), "PASS", "FAIL")[/FONT]
[FONT=&quot]Admittingly, I am a notice at functions, but need help with this issue.[/FONT]
[FONT=&quot]​[/FONT]
[FONT=&quot]​[/FONT]
[FONT=&quot]​[/FONT]
[FONT=&quot]BONUS POINTS IF THERE IS A FUNCTION THAT TURNS PASS GREEN, AND FAIL RED!!!!!
EVEN MORE BONUS POINTS IF YOU CAN DO IT IN TWO COLUMNS, ONE FOR NUMBERS AND ONE FOR PASS AND FAIL WITHOUT DISPLAYING FIRST TO CHARACTERS.[/FONT]
 

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.
Welcome to the MrExcel board!

Formula in B2 is copied down.
Then select B2 down to the end and apply the Conditional Formatting rules shown. If you need detailed steps for this, post back.

Excel Workbook
AB
1NUMBERS:PASS/FAIL:
206239808723FAIL
321328947982PASS
410298472498FAIL
529879229298PASS
663839743993FAIL
729874982749PASS
Pass fail
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B21. / Formula is =B2="PASS"Abc
B22. / Formula is =B2="FAIL"Abc
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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