IF-Then statement help

nethermit

New Member
Joined
May 24, 2010
Messages
9
Need help on how to formulate an if-then condition with an alphanumeric dataset.

Data
A1= XYC75007942
A2= XYC75007494
A3= BTA75041970
A4= BTA75029975
A5= MAA00176

If the data format is XXX75###### if true, then return "correct", otherwise "incorrect"
So, using the example data above, cell A1 to A4 should return "correct".

A little help please?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
This checks if the characters in positions 4 and 5 equal 75 and if the length of the all the text is 11 characters and if all the characters from 4 to 11 are numeric. This works for your example data.

Code:
=IF(AND(LEN(A1)=11,MID(A1,4,2)="75", ISNUMBER(VALUE(MID(A1,4,8)))),"Correct","Incorrect")

It doesn't check if the 1st three characters are alpha. That could be added if really needed.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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