Drop Down Selective list

LadyHarper

New Member
Joined
Jun 28, 2017
Messages
48
Office Version
  1. 365
Platform
  1. Windows
I have a list in Column A, This is my drop down options. However I only want it to select the options in Column A to display in the drop down, If the corresponding row in in Column C is greater then 0.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I think you need add a helper column, something like this in the helper column,
Excel Formula:
=IF(C1>0,A1,"")

then your dropdown pulls from the helper column. Does this make sense?
 
Upvote 0
I'm not sure this is what you want. The Main list is you actual list of items. The OFF/ON List shows when the value in column C for the current row is greater than Zero. The macro refreshes the value in the OFF/ON List each time the cursor moves.

Book1
ABCDEFGHI
2OneTwoThreeMain ListOFF/ON LIST
31511
4022
51633
644
7
Sheet1
Cell Formulas
RangeFormula
I3:I6I3=IF(INDEX(A:ZT,CELL("Row"),3)>0,G3:G6,"")
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
A3:A7List=$I$3#


This code needs to be put in the Sheet module for the sheet you have the Pulldown lists in column A
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  Range("I3#").Calculate
End Sub
 
Upvote 0
Yes Makes sense, and works. Are you able in your If statement to add, if N/A then leave blank?
 
Upvote 0
Replace the formula in cell I3 with this: =LET(C,IFERROR(INDEX(A:ZZ,CELL("Row"),3),0),IF(C>0,G3:G6,""))

It will work if it finds any error in column C
 
Upvote 0
Here is a quick example to conditionally populate a ListBox or ComboBox

When the ComboBox gets focus the list is conditionally updated via the following code. Source data for the list box is in A7:C13

VBA Code:
Private Sub ComboBox1_GotFocus()
  Dim rng As Range
  Dim lr As Long
  Dim cb As Collection
  Dim r As Long
  lr = Range("$A7:$A13").Rows.Count
  
  With ComboBox1
    Do While .ListCount > 0
      .RemoveItem (.ListCount - 1)
    Loop
    
    Set rng = Range("$A$7:$C$13")
    For r = 1 To lr
      If rng(r, 3) > 0 Then: ComboBox1.AddItem rng(r, 1)
    Next r
  End With
End Sub


Book2 (Autosaved).xlsm
ABC
5
6
7a1
8b0
9c0
10d1
11e1
12f0
13g1
Sheet2
 
Upvote 0
I think you need add a helper column, something like this in the helper column,
Excel Formula:
=IF(C1>0,A1,"")

then your dropdown pulls from the helper column. Does this make sense?
So far this makes the most scenes to use. As I have a dropdown list from data validate, however for the ones, that have 0 I get an N/A. Is there a formula to remove the N/A?
 
Upvote 0

Forum statistics

Threads
1,215,212
Messages
6,123,656
Members
449,114
Latest member
aides

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