SOLVED

Data Validation Formula to limit cell input range based on value in another cell

Copper Contributor

 

Hi,

 

This should be simple, but I cannot seem to find the same question asked before, and all solutions I have tried have failed.

 

If I have cell A1 and it contains any text (other than "LIMIT"), I do not want a limit to the value that can be input in cell B1.

If the text "LIMIT" appears in cell A1, the value that can be entered into cell B1 should be limited to 0-10(for example).

 

I know that you can use data validation to limit a cell input to between certain values, but I cannot work out how to apply this to a custom formula based on "LIMIT" appearing in cell A1.

 

Any help would be much appreciated.

 

Chris

5 Replies
best response confirmed by CSPENNINE (Copper Contributor)
Solution

@CSPENNINE 

Select cell B1.

On the Data tab of the ribbon, click Data Validation.

Select Custom from the Allow dropdown.

Enter the following in the Formula box:

 

=OR(A1<>"LIMIT",AND(B1>=0,B1<=10))

 

If you wish, enter appropriate messages in the Input Message and Error Alert tabs.

Click OK.

@Hans Vogelaar 

 

Thanks so much. I was trying to use "A1=" instead of "A1<>".

 

Chris

@CSPENNINE 

 

Hi, 

 

I want to limit the number of responses from my custom list.

 

For example if i a have list which have Yes & No and i want to restrict the number of times where Yes drop down menu can be selected.

 

Can you please help.

Thanks in advance

@Iceman123 

See the attached sample workbook. You are allowed to select 'Yes' at most 5 times.

There is VBA code in the worksheet module. Right-click the sheet tab and select 'View Code' to inspect the code, and to change the number of times 'Yes' can be selected, if you wish.

You'll have to allow macros when you open the workbook.

@Hans Vogelaar Hi, Thank you soo much. You are totally a life saver. Really appreciate it.

 

God Speed.

1 best response

Accepted Solutions
best response confirmed by CSPENNINE (Copper Contributor)
Solution

@CSPENNINE 

Select cell B1.

On the Data tab of the ribbon, click Data Validation.

Select Custom from the Allow dropdown.

Enter the following in the Formula box:

 

=OR(A1<>"LIMIT",AND(B1>=0,B1<=10))

 

If you wish, enter appropriate messages in the Input Message and Error Alert tabs.

Click OK.

View solution in original post