In yesterday's tutorial we started to look at Excel Data Validation - what its purpose is, how it works, and how to use built-in rules to validate data in your worksheets. Today, we are going to take a step further and talk about the nitty-gritty aspects of custom data validation. Continue reading
Comments page 7. Total comments: 286
I am using excel to create a form, one of the cells is for current job title. But in another section I have "New" job title, both the current and new job title are used for calculations. So what I'm trying to do is if there is nothing in the "new" cell it will equal the "current" or if they need to change the title there is a validation drop down list. Right now it seems I can only do one or the other not both. Can you help me?
Hi,
I don't want the user to enter data in a third cell (C1) as the first (A1) and second cells (B1) are empty
I want the user must get a warning message Whenever user trying to enter it on third cell (C1) and it should not show the warning message when (A1) & (B1) are not empty.
Can we do it with data validation?
Thanks,
Hi, I wanted to restrict data entry in a specific format which would be as follows:
dd/mm - dd/mm
This cell will not be in a date format. What I required the user to input date range (as text), for example, 01/11 - 15/11 or 16/12 - 31/12. Is this possible with data validation.
Thanks for your great work.
Good morning. I have a team and each member has their own alpha split and I need to be able to restrict their input into cells depending on the first name of the customers initial.
Basically I need data validation to show an error if a user enters a name not within their split eg one user deals with customers surnames beginning with the initials A to F
I have tried a few variations eg =countif(b3,"a-*")+countif(b3,"b-*") etc but no luck so far.
Any help greatly appreciated. Thanks
Why would a simple validation formula,=(A1+A2) fail, i.e., accepts entries that are not equal to the contents of A1 + A2??
Hi John,
If you select "Custom" in the Allow box, the formula fails indeed. However, if you allow "Whole number" equal to =A1+A2, it works. I cannot say why.
Hi,
I just wanna ask if I can use data validation if i want to restrict the text to be inputted. Example, Middle Name to be inputted but the user input Middle Initial Only. Is it possible to prompt "error" message using data validation? If yes, how? Thanks
I created a list called test1. In this list are part numbers some of these PN's are specific i.e. D2301-00-03 where as other are a range represented with wildcards i.e. 100-N*** which covers a part number range from 100-N000 through 100-999. The length of the part numbers may be different and the placement of letters and numbers may be different as seen above.
I am trying to limit data entry into a cell (A1) only if it matches this list.
I have attempted to do this using the COUNTIF formula in DATA VALIDATION function in cell (A1). It is not working. Any ideas? Thanks.
I'm trying to highlight in red number ranges that is incorrect based on criteria of first cell column for example if Cell A1 has drop down options of NSW,QLD,VIC then in B1 it returns highlights in red cell fill if the number entered in B1 isn't within criteria range for example If Cell A1=NSW then acceptable number range for B1 is 2000-2999 else it highlights the cell in B1 in red and if A1=QLD then B2 should be between 4000-4999 else it highlights that cell in red.
Is this something doable with custom formula?
HOW TO RESTRICT DUPLICATE MOBILE NO IN A SPECIFIC COLUMN
HI LAKSHMI,
USE THIS METHOD
=COUNTIF(A2:C30,A2)=1
Hello,
IN (Excel data validation to allow text only). I want that no one will be able to enter John 1 or John22. Because in this context I can enter John 1 or John 22. But i want that if someone enter john1 by mistake than it will show the Error message.
If I want to create a sheet where if one does not put any data (left it just blank) in one cell, suppose B2, he can't put any data in C2 ... How to do it?
Every code start with unique value and fixed value plzz.. solve the question
Can anyone tell me a quick and easy way of validating the following:
I've got a series of questions with Yes/No validation already set up. However, if No is recorded is B2 and the next 2 questions (C2 and D2) only apply if the answer to B2 is Yes, how do I prevent someone recording a response in C2 and D2 and automatically record a N/A?
Hope that makes sense.
I am trying to format and or validate a cell in Excel 2013 to allow only a certain format. I want a six digit (customer ID) that can only start with a letter (either A, B, D, G or J)) and has exactly 5 digits following the letter. Anyone have any clue how to make this happen?
Rik:
You can use a list for the letters. This can be a drop down box in the entry cell. The five digit numbers can be in an adjacent cell.
Using the letters create a data validation list.
Then select a cell to create the first validation cell.
Select Data tab and choose Validation.
Then in the validation window in the Allow field select the List option and enter the cell range that contains your letters. Be sure to check the in-cell drop down box. Then click OK.
The number validation is the same process except in the Validation window you select Text Length from the Allow field, Equal to from the Data field and type in the number 6 in the Length field.
If you need the data to be in one cell then you can concatenate the cells.
Hi,
I have a requirement where a cell should allow a few specific text entries (OR) Allow decimal values only in a range (ex: -200.00 to 200.00).
Please help me.
Thanks
Hi. Love your work!
Is it possible to have a data validation character limit on a concatenated cell? Example : Cell C1 has formula =A1&B1. I don't want the characters in C1 to exceed 20. I've tried custom data validation with formula =LEN(A1)+LEN(B1)<=20, but it doesn't work. Any suggestions?
Thank you
Kiwi:
I don't think you need to customize the Data Validation in Excel. Just select "Text Length" from the first drop down and then "less than or equal to" in the second field
and enter "20" in the third field. Be sure to check or uncheck the "Ignore Blanks" check box, then enter the message to users in the message tabs and that should work.
Thanks Doug
That's what I tried first. It doesn't work, as it's looking at the text length of the formula, and not the results (I think). =A1&B1 only has 6 characters.
Thanks for writing article
Kiwi:
Each time I've tested that technique it works.
Are there a bunch of spaces or other blank characters in A1 or B1?
Good day.
I am having a strange issue with use of formula while creating a Data validation drop-down list in one of my cells.
Formula =IF(HOVEDTABELL[FAG]="RIE"; RIETEGNINGER;RIBTEGNINGER) is tested and working if entered directly in the main worksheet. true and false conditions route to two different table on neighbouring tabs btw.
When I try to use the same formula while creating a Data validation list, i get the "We found a problem with this formula" warning.
Could you please suggest what could be the issue?
Thank you.
Hey folks,
I need to make few cells required, but in case a user did not do anything on a tab (I have about ten of them in the file) I need to allow a user to save and close the file. Only if a user starts to work at THIS tab I need to force a user to fill in 3 cells within that tab.
Could not find this anywhere, is this doable? All examples I saw invoke a VB scripting and that forces a user to fill in cells unconditionally, simply does not allow to close a file while cells not filed in. Not my case, I have to allow to close a file with these cells empty. And force a user to fill them up only if he/she starts to work at a tab with such condition.
Thanks a lot!
Hi, I want to lock some cells in a form, but would like to do it with validation. Is it possible?
thnaks!
validate for text length less than 0, obviously this will never be true, so no input is possible
unless someone copies something there, of course
I have the same problem. I tried to make the cell equal itself in the custom formula. That stops the user from changing to another text entry but is allowing numbers. Did this ever get resolved?
how do I use data validation (a list or a formula) so that I can restrict the data entry to be only
capital letters
& (the ampersand sign)
, (a comma)
. (a period)
=IF(M2"";ISTEXT(L2),ISNUMBER(L2)) - why not working. If any value is there in m2, the l1 should accept numbers or else text
Hello,
Please try the following formula:
=IF(ISBLANK(M2),IF(ISTEXT(L2),T(L2),TEXT(L2,"@")),VALUE(L2))
Hope it will help you.
what sign is the use in formula for "does not equal too" like
IF(G6="does not equal too either does not blank",VLOOKUP(G6,A6:C19,2,0),"")
Hi Amit,
The "not equal to operator" in Excel is <>
For example:
=IF(AND(G6<>"text", G6<>""),VLOOKUP(G6,A6:C19,2,0),"")
How do I use a validation list and be able to input other data?
Thanks for the instructions! How should a data validation formula look if I'm trying to specify that cells in a particular column should be formatted in either MMDDYEAR or MMDDYEAR ## format? 01, 02, etc. are added to the end of rows with the same date. (ex. 07071980, 07071980 01)
Hello, Lisa,
I can suggest you the following formulas:
1. In case the values are entered in the MMDDYEAR format:
=AND(NOT(ISERROR(DATE(MID(A1,5,4),LEFT(A1,2),MID(A1,3,2)))),VALUE(LEFT(A1,2))<13,VALUE(LEFT(A1,2))<>0,VALUE(MID(A1,3,2))<>0,LEN(A1)=8)
2. In case the values are formatted as MMDDYEAR ##:
=AND(NOT(ISERROR(DATE(MID(A1,5,4),LEFT(A1,2),MID(A1,3,2)))),VALUE(LEFT(A1,2))<13,VALUE(LEFT(A1,2))<>0,VALUE(MID(A1,3,2))<>0,LEN(A1)=11, ISNUMBER(VALUE(RIGHT(A1,2))))
If neither of the formulas above help you, I’m afraid you need to use a special macro then. We do not cover the programming area (VBA-related questions). Please try to find the solution in VBA sections on mrexcel.com or excelforum.com.
Sorry I can't assist you better.
Try use this formula for custom validation which prevent any input which start phrase "XYZ" in Cell A1: =search("xyz",A1,1)=1
Thanks for the article. I was having an issue with this validation formula, =IF(IF(D5"",D5,C5)"F",H5="B",IF(IF(F5"",F5,E5)="B",H5="B",OR(H5="M", H5="B"))) and found your article. I had to remove the check for "Ignore Blanks" and check for blanks myself like this, =IF(IF(D5"",D5,C5)"F",OR(H5="B",TRIM(H5)=""),IF(IF(F5"",F5,E5)="B",or(H5="B",TRIM(H5)=""),OR(H5="M", H5="B",TRIM(H5)=""))) because D5 and F5 did contain blanks making it possible to enter anything even though the formula itself returned a 'False'. You pointed me in the right direction.
What would be the formula on data validation, example the minimum amount is $25 and maximum $300 ?
I've a requirement where i should NOT allow user to enter a value which starts with some phrase like "xyz". Please help me with formula.
Thanks in Advance
I need to create a excel material inventory recording sheet,all material >0 g, must record down the material expiry date.
Example:
If cell A1 is "0", cell A2 must key in "NA"
If ell A1 IS ">0", cell A2 must key in "the expiry date"
I wanted to restrict cell A2 to input date format or "NA" with reference to cell A1, can I use date validate with formula? or any suggestion?
Hello Jayson,
You can use the IF function, e.g. enter the following formula in A2:
=IF(A1=0,"NA","the expiry date")
If you can refer to the expiry date, e.g. if the date is in cell C1, then set the cell format of A2 to date and include the reference:
=IF(A1=0,"NA", C1)
Im having trouble adding to formula i did for custom validation.
The formula points to several lists depending on what is in cell N2.
I have tried this both 'Allow Custom' and 'Allow List' and receive the error:
"There's a problem with this formula.
Not trying to type a formula?
When the first character is an equal(=) . . . "
Not sure why i can update the formula by adding another list reference.
Any ideas?
Thanks
Tam
Hello Tam,
Could you specify what formula you use and what result you need to get? If possible, please send a sample file to support@ablebits.com along with a link to this post and your comment. We'll do our best to assist you.
I created an excel workbook with multiple sheet that does some accounting and mathematics calculation.
Pls how can I turn this workbook to a desktop or mobile application that runs on it own?.
Or which programming language do I have to learn to create an app that calculates using same kind of function in Excel.
Thanks in anticipation.
Hello, Patrick,
I'm sorry but you'd better ask these questions on Mr. Excel forum. They deal with some programming/VBA stuff there, so they may be able to assist you better.
Conditional Formatting Duplicate value does not working when "/" or space is inserted please guide me
example
Khalid Khalid/Asif
Math Bio/Com
I need to convert -ve time value to +ve need your support.
For Example:
-2:20 to 2:20
-1:18 to 1:18
-0:17 to 0:17
Hi Svetlana,
A very short message. You are brilliant, Thank-you
I recently set up the following function in Excel, to look for a list of words in ONE cell, and if it finds any of the words listed in my formula, then 'red-flag' to say "Keyword Exclusion". Again, currently it's looking at only ONE cell (cell 'I2' in the formula below); and it's working beautifully!
However, I now need for the formula to look at a SECOND cell as well. If it finds any of the same words listed in that second cell, then simply perform the same 'red-flag' coding. I've tried different variations of "IF(OR and AND" formulas, but it's not working.
My current formula is as follows:
=IF(SUMPRODUCT(--ISNUMBER(SEARCH({"motor vehicle","construction","public transportation","health","family","criminal","revitalization"},I2)))>0,"Keyword Exclusion","")
Hi Ignacio,
If you want the OR logic, i.e. if any of the words is found either in I2 or, say K2, simply concatenate the two cells like this:
=IF(SUMPRODUCT(--ISNUMBER(SEARCH({"motor vehicle","construction","public transportation","health","family","criminal","revitalization"}, I2&K2)))>0, "Keyword Exclusion","")
If you want the AND logic, i.e. if any of the words is found both in I2 and K2, then check each cell individually:
=IF(SUMPRODUCT(--ISNUMBER(SEARCH({"motor vehicle","construction","public transportation","health","family","criminal","revitalization"},I2)), --ISNUMBER(SEARCH({"motor vehicle","construction","public transportation","health","family","criminal","revitalization"},K2)))>0, "Keyword Exclusion","")
Can you clarify the find and search formulas in the article are correct?
Case-insensitive: =ISNUMBER(SEARCH($A$2:$A$6, A2))
Case-sensitive: =ISNUMBER(FIND($A$2:$A$6, A2))
Based on the rest of the section, should the data range listed be replaced with "AA"? Otherwise, I don't follow how the range helps with SEARCH or FIND.
These articles are great. I always find new ways to improve my sheets.
Hi!
The correct formulas are =ISNUMBER(SEARCH("AA", A2)) and =ISNUMBER(FIND("AA", A2)) as shown in the screenshot. Don't know where those ranges came from. Sorry for the confusion and thank you - the formulas are fixed.
Hi
Using data validation, I know it is possible to do the below separately:
1. Create a data validation drop down list (ALT + A + V + V then select list from the 'Allow' field and denote the cell range in the 'Source' field)
2. Prevent users from entering data into one cell (e.g. cell A2) if another cell (e.g. cell A1) has not yet been populated (ALT + A + V + V then select Custom from the 'Allow' field and insert '=NOT(ISBLANK(A1))' in the 'Formula' field)
However, I am in need of a combination of both. I need to customise a cell such that if cell A1 is not populated, then cell A2 cannot be populated but, when cell A1 has data inserted, A2 should be able to be populated but only through a drop-down list. May you assist