If the first 3 characters are alpha, then return true

HockeyDiablo

Board Regular
Joined
Apr 1, 2016
Messages
182
Looking for a formula to check the first 3 characters of a string and return TRUE if all three are "A-Z only"

=IF(ISNUMBER(VALUE(LEFT(J6,3)))=FALSE,TRUE,FALSE)

abc123 = true
123abc = false
a1b2c3 = false
 
Here's sort of a brute force approach:

=AND(UPPER(MID(A1,ROW($1:$3),1))>="A",UPPER(MID(A1,ROW($1:$3),1))<="Z")
Confirmed with Control+Shift+Enter.

It should work if you don't insert any rows before 4.
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi Eric

If you use a constant array, the formula is not a formula array. Also, the string comparison is case insensitive

"b">"a"
"b">"A"
"B">"a"
"B">"A"

Using your formula:

=AND(MID(A1,{1,2,3},1)>="A",MID(A1,{1,2,3},1)<="Z")
 
Upvote 0
Thank you gentlemen, this is working great now. Appreciate all of the help. Saved my neck for sure.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,118
Messages
6,128,939
Members
449,480
Latest member
yesitisasport

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