Allow first 5 digit alpha then next 4 digit numerical and last digit alpha only

prakashkumar

New Member
Joined
May 9, 2021
Messages
45
Office Version
  1. 2010
Platform
  1. Windows
Sir,
How to allow only first 5 digit alpha then next 4 digit numerical and last digit alpha in excel data validation
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try:
Book1
B
3abcde1234f
Sheet6
Cells with Data Validation
CellAllowCriteria
B3Custom=ISERROR(MID(B3,1,1)+0)*ISERROR(MID(B3,2,1)+0)*ISERROR(MID(B3,3,1)+0)*ISERROR(MID(B3,4,1)+0)*ISERROR(MID(B3,5,1)+0)*ISNUMBER(MID(B3,6,4)+0)*ISERROR(MID(B3,10,1)+0)*(LEN(B3)=10)
 
Upvote 0
Solution
Or try this:

Book1
BC
3abcde1janz0
4abcde1234z1
Sheet1
Cell Formulas
RangeFormula
C3:C4C3=(COUNT(--MID(B3,{1,2,3,4,5,10},1))=0)*(COUNT(--MID(B3,{6,7,8,9},1))=4)*(LEN(B3)=10)
 
Upvote 0
Phuoc, thanks for pointing out that sometimes the "text+0" trick will incorrectly flag text as numbers, as with "1jan". That could be an issue depending on the specific data. My original formula could be remediated by taking the characters individually.

However, it's also worth noting that array constants such as {6,7,8,9} are not allowed in DV formulas.
 
Upvote 0

Forum statistics

Threads
1,216,115
Messages
6,128,919
Members
449,478
Latest member
Davenil

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