Restrict Data Validation

Gilliam

Active Member
Joined
Jul 10, 2014
Messages
286
Hello,
I am having an issue restricting a cell to only what is in the drop down.
I have a cell that is data validated as a list to be passed this:
=IF(B4="Lease",$O$3:$O$6,INDIRECT(VLOOKUP($P$21,$O$2:$S$17,5)))

the indirect passes a range for example "O2:O11" which would fill the drop down with numbers 1 through 10. so after the VLOOKUP, it should look like...
=IF(B4="Lease",$O$3:$O$6,INDIRECT(O2:O11))

Including an error alert does not work in restricting the data, nor does it even do anything... I'm wondering if the formula with indirect is the problem?

Any help would be appreciated, thanks.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
what is in the cell identified by the VLOOKUP?

P21 is this formula
ROUNDDOWN((TODAY()-((B2-1900)*365.25))/365,0)

The user enters a year of a vehicle, and excel gives how old the vehicle is.
it is just a number, 1 through 16.
 
Upvote 0
Hi,

My experimenting shows that if B4=Lease the validation works correctly and 4 values are picked up as options in the drop down list. What do you have in column S next to each number 1 to 16? It needs to be a string giving the address of the data that should appear in the validation. I've set my sheet up to do this and it works fine.

In summary: You have overlapping data in that the LEASE validation list is in the lefthand side (the tested side) of you VLOOKUP, you need to make sure that the VLOOKUP returns an address (this can simply be typed in as text into column S.

Hope this makes sense, if not can you submit a sample of your sheet.Can you send a sample sheet?

Regards
 
Last edited:
Upvote 0
B
O
P
S
2008
1
O2:O16
=2014-B2
2
O2:O15
data validation here
3
O2:O14
4
O2:O13
5
O2:O12
6
O2:O11
7
O2:O10

<TBODY>
</TBODY>

I just want to restrict the user form entereing ... say 600
 
Last edited:
Upvote 0
I hate to say it, but as you've described it and using the info abovethe validation works perfectly well for me. If I put 2008 in B2, I get 6 in B3 and 6 in P21, the validation list is then values 1,2,3,4,5,6,7,8,9,& 10. If I put in 2012 in B2 I get 2 in B3 and P21 and a validation list 1,2,3,4,5,6,7,8,9,10,11,12, 13 & 14.

Why not just restrict cell B2 to being an integer in the range you need?

Sorry this isn't more helpful.

Regards

Peter
 
Upvote 0
I hate to say it, but as you've described it and using the info abovethe validation works perfectly well for me. If I put 2008 in B2, I get 6 in B3 and 6 in P21, the validation list is then values 1,2,3,4,5,6,7,8,9,& 10. If I put in 2012 in B2 I get 2 in B3 and P21 and a validation list 1,2,3,4,5,6,7,8,9,10,11,12, 13 & 14.

Regards

Peter

Oh the drop down works like a charm, however I can't restrict the user from inputting a number outside of that list (just typing it on their own).
 
Upvote 0
Can you check that there is a tick in the check box for 'Show error alert after invalid data is entered' on the 'Error Alert' tab of the Data Validation dialogue?

If not, tick it and it should work, if it doesn't I think I'm stumped too!
 
Upvote 0
It's ticked and it still allows me to enter numbers > 16 :( Thanks anyway! Must be something to do with having a formula as a source... I'll keep digging.
(Excel 2007).
 
Upvote 0
We're using the same versions and my sheet restricts values so its nothing to do with the formula. I've sent you a private message with my e-mail, if you send me the spreadsheet I'll have a look.

Regards

Peter
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,583
Members
449,174
Latest member
chandan4057

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