IF statement if not in a specific format

surkdidat

Well-known Member
Joined
Oct 1, 2011
Messages
582
Office Version
  1. 365
Is it possible to have a cell in an IF statement populate text if it is not in the following format ABC_12345 (ie Letter, letter, letter, underscore, number, number, number, number, number)

The same three letters will always start the format, then always an underscore, then a 5 digit number, the first will always be a 1.

If it is in any other format, or additional characters such as brackets etc are added, i need a message displayed

This needs to be in a formula, rather than using Data Validation, or conditional formatting etc, as for some reason the programme the spreadsheet is uploaded into doesn't like that!

So, I need something that basically is
Excel Formula:
= IF(C2<>"ABC_12345,"Wrong format","Correct format")
- with the emphasis of the TRUE bit being if it does not match
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
See if this does what you want. If not, more examples and explanation please.

23 08 25.xlsm
AB
1ABC_12345Correct
2ABC_42346Wrong
3XXX_12345Wrong
4ADC_123456Wrong
5ADC_123(57Wrong
6ADC_123-5Wrong
7ABC_19999Correct
8ABC_123Wrong
Check Format
Cell Formulas
RangeFormula
B1:B8B1=IF(AND(LEFT(A1,5)="ABC_1",LEN(A1)=9,ISNUMBER(MID(A1,6,1)+MID(A1,7,1)+MID(A1,8,1)+MID(A1,9,1))),"Correct","Wrong")
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,991
Members
449,094
Latest member
masterms

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