Dropdown List Based on List Size

default_name

Board Regular
Joined
May 16, 2018
Messages
180
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
Hey guys,

I have a dropdown list that I am trying to create. I have looked at several other places on the internet to try and solve this, but have been unsuccessful.
I've done a run-around with Dyanamic Data, Data Validation and conditional statements and am back to square one.
You guys always seem to give the best feedback and simplified answers.

Here's what's going on.
I have a workbook with two worksheets in it.

Sheet1
[TABLE="class: grid, width: 200"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A
[/TD]
[/TR]
[TR]
[TD="align: center"]1
[/TD]
[TD="align: center"]Versions
[/TD]
[/TR]
[TR]
[TD="align: center"]2
[/TD]
[TD="align: center"]Red 2.0
[/TD]
[/TR]
[TR]
[TD="align: center"]3
[/TD]
[TD="align: center"]Red 2.2
[/TD]
[/TR]
[TR]
[TD="align: center"]4
[/TD]
[TD="align: center"]Blue 1.6
[/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]Blue 1.8
[/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]Violet 3.4
[/TD]
[/TR]
[TR]
[TD="align: center"]7
[/TD]
[TD="align: center"]Green 3.4
[/TD]
[/TR]
[TR]
[TD="align: center"]8
[/TD]
[TD="align: center"]Blue 1.8a
[/TD]
[/TR]
[TR]
[TD="align: center"]9
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]10
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]11
[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]12
[/TD]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]

Sheet2
[TABLE="class: grid, width: 450"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A
[/TD]
[TD="align: center"]B
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]Which version are you using?
[/TD]
[TD]*dropdown list is here*
[/TD]
[/TR]
</tbody>[/TABLE]

In Worksheet 2 I have Data Validation set up in cell B1.
='Sheet1'!$A$2:$A$20
I will potentially have more items to add to the list in Sheet1 in the future (hence the range going to A20).

Since the range I selected goes to A20, there are 12 blank spots that appear at the bottom of my Sheet2 dropdown list.
I check-marked 'Ignore Blank' in the Data Validation window with the hope that the dropdown list will only show the current options in cells A2:A8.
The 'Ignore Blank' doesn't seem to be ignoring those 12 blank cells.

What am I doing wrong here? Is there another method I could use?
Is there a way to set up Data Validation to auto-adjust for the Sheet1 list size?

Thanks in advance for your help!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hi there.

As far as I know there is no formula way of doing it, but providing you can use macros, the following small routine will do the trick for you. If you put it in a workbook open routine, or you could run it in a change event handler on Sheet1:
Code:
Sub ReSizer()

Dim LastRow As Long
    LastRow = Sheets("Sheet1").Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row

    With Range("B1").Validation
        .Modify Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
        xlBetween, Formula1:="=$A$1:$A$" & LastRow
    End With
End Sub
 
Upvote 0
If you turn your list into a table and then select A2:A8 & give it a name using the name manger, you can then refer to that name in the Data validation options.
Whenever you enter a new value at the bottom of the list, it will be automatically included in the DV
 
Upvote 0
Try using this as your DV formula:

=OFFSET(Sheet1!$A$2,0,0,COUNTA(Sheet1!$A$2:$A$20))

assuming no gaps in your list.
 
Last edited:
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,954
Messages
6,175,601
Members
452,658
Latest member
GStorm

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