Two validations in one Cell

zargon

New Member
Joined
May 4, 2017
Messages
10
Hi.

I'm a new user and i'm finding a solution for this case:

I need that in a one cell the user input only can write a string specifically of 7 or 10 characters, the values 1 to 6 and 8, 9, or greater than 10 are not valid, I tried to solve this with validation but i can't, i hope anyone can help me.

Thanks.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I'm confused about your requirements.

The string must be 7 or 10 characters in length (not 8 or 9)
The digit "7" must not be in the string. But, where (if anywhere) is the digit "0" allowed?

Are there any letters allowed in the string? If so, must they be at the start or end of the string or in specific positions?
 
Upvote 0
Thanks for the answer Mike.
I need that the input only accept 7 or 10 characters, it doesn't matter if the string contains letters or numbers.
 
Upvote 0
I need that in a one cell the user input only can write a string specifically of 7 or 10 characters, the values 1 to 6 and 8, 9, or greater than 10 are not valid, I tried to solve this with validation but i can't, i hope anyone can help me.
For some reason, you did not tell us which cell you wanted this for, so I have assumed cell F1 (change as necessary). Use this Custom Data Validation Formula...

=(LEN(F1)=7)+(LEN(F1)=10)
 
Upvote 0
[FONT=wf_segoe-ui_normal]Thank you so much Rick Rothstein sorry for omit specify the cell[/FONT][FONT=wf_segoe-ui_normal]... this works perfectly. I hope not to bother, one more question... what if i want personalize a messeage instead of a true or false values in the validation?[/FONT]
 
Upvote 0
[FONT=wf_segoe-ui_normal]...what if i want personalize a messeage instead of a true or false values in the validation?[/FONT]
I am not exactly sure what you mean by this... the validation must be a True/False result. You can craft the message that is displayed when the input is not 7 or 10 characters long though... is that what you meant? You would do that by clicking the "Error Alert" tab on the Validation dialog box and selecting the style of the message box as well as filling in the message box title and text to display.
 
Upvote 0
Well, i tried with =IF(LEN(A4)=7,"OK","NO"), and this works for me... now i have some problems to validate the 2 cases like your previous answer =(LEN(F1)=7)+(LEN(F1)=10), but usuing the IF function to include "OK" or "NO" message...
 
Upvote 0

Forum statistics

Threads
1,217,053
Messages
6,134,312
Members
449,865
Latest member
dhpaul1031

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