Formula - Exclude cells that include letters

Tangled1

New Member
Joined
Dec 10, 2021
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I have a list to check if business directory has been entered correctly. Criteria is:

Include 6 numbers = "correct"
More than 6 numbers = "incorrect"
Less than 6 numbers = "legacy"
Note: I the cell includes any letter it should be recognised as "incorrect"

I am experiencing problems if the cell contains a letter e.g. A12345 or B54321. My formula notes them as "correct":
Excel Formula:
IF(LEN(C2)=6,"correct",IF(LEN(C2)>6,"incorrect", IF(LEN(C2)<6,"legacy","")))

Please can someone help?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
How about
Excel Formula:
=IF(OR(ISERR(C2+0),LEN(C2)>6),"incorrect",IF(LEN(C2)=6,"correct","legacy"))
 
Upvote 0
Solution
This works a treat! I was afraid reading the formula it would include those less than 6 numbers also as "correct".

Please can you explain how this formula works so I can understand and learn from it?

Thanks a bunch, Fluff!
 
Upvote 0
If you add 0 to text you get an error, so the formula checks to see if you get an error, or if the cell is more than 6 characters. If it matches either criteria, you get Incorrect.
 
Upvote 0
If you add 0 to text you get an error, so the formula checks to see if you get an error, or if the cell is more than 6 characters. If it matches either criteria, you get Incorrect.
Thanks again! I will keep this thread open for me just incase of trailing questions and will close the thread as resolved tomorrow. Hope that's ok
 
Upvote 0
Glad to help & thanks for the feedback.
Any further questions that are not related to this question, should have a new thread.
 
Upvote 0

Forum statistics

Threads
1,213,557
Messages
6,114,287
Members
448,562
Latest member
Flashbond

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