Looking for a formula or VBA for a condition: if in a cell first character is a letter and 2nd character is a number

Mifti

New Member
Joined
Dec 22, 2020
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
Hello,

Can I can get help in finding formula or VBA for a condition: If in a cell 1st character is a letter and 2nd character is a number then result is correct otherwise incorrect.

Appreciate this help in advance.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Say your data is in A1, then

Excel Formula:
=IF(AND(IF(ISERR(LEFT(A1,1)*1),0,1),IF(ISERR(MID(A1,2,1)*1),1,0)),"OK", "Not OK")
 
Upvote 0
I think Zot might have the conditions the wrong way around?

Try this

20 12 22.xlsm
AB
1abcNot OK
2a123OK
32aedNot OK
4345ABCNot OK
5A2BC#4DOK
Letter Number
Cell Formulas
RangeFormula
B1:B5B1=IF(AND(ISERROR(LEFT(A1,1)+0),ISNUMBER(MID(A1,2,1)+0)),"OK","Not OK")
 
Upvote 0
I think Zot might have the conditions the wrong way around?

Try this

20 12 22.xlsm
AB
1abcNot OK
2a123OK
32aedNot OK
4345ABCNot OK
5A2BC#4DOK
Letter Number
Cell Formulas
RangeFormula
B1:B5B1=IF(AND(ISERROR(LEFT(A1,1)+0),ISNUMBER(MID(A1,2,1)+0)),"OK","Not OK")

Looks like I did it again :LOL:. And also just copy and not simplify it :( .... mind is on holiday already
 
Upvote 0
OMG! This help is incredible. Thank you all.

A little further help if you guys can: Only two characters ( 1st a letter and 2nd a number) are allowed in the cell. For example A14 would not be OK as has more than two characters.
 
Upvote 0
How about
+Fluff v2.xlsm
AB
1abNot OK
2a1OK
32aNot OK
4b#Not OK
5a23Not OK
Main
Cell Formulas
RangeFormula
B1:B5B1=IF(AND(LEN(A1)=2,ISERROR(LEFT(A1,1)+0),ISNUMBER(RIGHT(A1,1)+0)),"OK","Not OK")
 
Upvote 0
Solution
Thanks much Fluff. It works as I want to be.

Happy Holidays ( if you have some) and Happy New Year to all and please stay safe!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,521
Messages
6,120,018
Members
448,937
Latest member
BeerMan23

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