Creating a drop down list (with formula?)

DarkSmile

Board Regular
Joined
Feb 22, 2021
Messages
90
Office Version
  1. 365
Platform
  1. Windows
Hi,

I need some help with a drop down list, if been googling sinds yesterday, tried a bunch of stuff but unable to get what i'm trying to achieve.
I have a list:

Cell Formulas
RangeFormula
B5:M26B5=IFNA(INDEX(Certivin!$M:$M,MATCH(1,($A5=Certivin!$A:$A)*(B$4=Certivin!$C:$C),0)),"")


I want a drop down list based on where there is an "x", example:

Row 5: has an "x" in J, so the drop down should show "IFS Logistics"
Row 26: has "x" in F, K so the drop down should show "BRC Food, IFS Food" underneath each other (not next to each other).

I could just select the full row but I don't want blanks in the drop down:

If got a formula to separate them with a comma, but now I need to get this in to a drop down as follows

Code:
=TEXTJOIN(", ",,IF(B26:M26="x",$B$4:$M$4,""))

Example row 26:
BRC Food
IFS Food
...

And not as BRC Food, IFS Food

I tried the following formulas, but without success.

Code:
=INDIRECT(SUBSTITUTE(BB26,",",""))
Code:
=SUBSTITUTE(BB26,",","")

Is there anything else I can try? It's not limited to 2 "x" per lane.

Thank you
David
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
What you asking for can not be done with a formula in the data validation list box. You would need to produce the condensed list in a worksheet (1 list for each row).

The other option would be to use vba to create the list without a formula, perhaps with a selection change event.
 
Upvote 0
What you asking for can not be done with a formula in the data validation list box. You would need to produce the condensed list in a worksheet (1 list for each row).

The other option would be to use vba to create the list without a formula, perhaps with a selection change event.
I'm not able to write vba, are you able to help me with such code?
 
Upvote 0
I will be able to but it's taking me a bit longer to get it done than anticipated, I'm away from home and don't have my laptop with me. With a phone, my ability is limited to writing simple formulas.

I can't see which version of excel you're using on your profile, but if you have the FILTER function then it may work with a formula. There are limits on the types of formula that can be used with data validation dropdowns and I had it in mind that it didn't work when i tried it once before but could giving it a go before trying vba.

Excel Formula:
=TRANSPOSE(FILTER($B$4:$M$4,B26:M26="x"))
 
Upvote 0
I will be able to but it's taking me a bit longer to get it done than anticipated, I'm away from home and don't have my laptop with me. With a phone, my ability is limited to writing simple formulas.

I can't see which version of excel you're using on your profile, but if you have the FILTER function then it may work with a formula. There are limits on the types of formula that can be used with data validation dropdowns and I had it in mind that it didn't work when i tried it once before but could giving it a go before trying vba.

Excel Formula:
=TRANSPOSE(FILTER($B$4:$M$4,B26:M26="x"))
Sorry late response, I'm using Excel 2016. As a normal formula this works, but in data validation it does not.

1662373774553.png
 
Upvote 0
With that error it should work if you click yes. That just means that there is no x in that row when you're setting it up.

Also, I would suggest that you double check that the formula does work in the sheet. That formula wouldn't work in Excel 2016.
 
Upvote 0
With that error it should work if you click yes. That just means that there is no x in that row when you're setting it up.

Also, I would suggest that you double check that the formula does work in the sheet. That formula wouldn't work in Excel 2016.
The formula does work in a cell, just not in the data validation thing.
1662555513668.png
 
Upvote 0
I'll set up a test sheet when I get home so I can check what is happening with it. (Thursday evening uk time).
There are some limits on formulas that can be used in validation but usually it won't let you enter any that can't be used.
 
Upvote 0
Sorry, it took a bit longer than expected before I had chance to look at this. As far as the error goes, it appears that the formula can be entered as a validation rule but will not allow the dropdown to function correctly. It works for manually entered data (typing entries into the validated cells instead of using dropdowns), but that appears to be the limit.

The mini sheet below shows a slightly different way of doing it, by using a helper range (if acceptable) that can be hidden once the sheet is set up. You only need to enter the formulas into column O, they will fill right dynamically as needed. Then set up the data validation referring to =O5# as the dropdown source for N5 and apply it to the rest of the column as needed.

Note that there need to be enough empty columns for the filter formula to use if there are more x's in the row, ideally I would keep columns O:Z empty so that there are the same number of empty columns as there are in the table. If you have other data in those columns already then you can start farther to the right as opposed to moving what you already have. That is just down to your personal preference.

I've gone for the simpler method first, if you can't use the helper range method then I'll sort out the vba alternative for you sometime over the next couple of days (will wait for you to confirm if it is still required first).

Book1
BCDEFGHIJKLMNOP
4BRC ASDABRC Agents & BrokersBRC Packaging MaterialsBRC S&DBRC FoodFSSC 22000BRC GFCPIFS BrokerIFS LogisticsIFS FoodIFS Wholesalte Cash & CarryIFS Global Markets Food
5xIFS Logistics
6xIFS Food
7xIFS Food
8xIFS Food
9xFSSC 22000
10xFSSC 22000
11xFSSC 22000
12xFSSC 22000
13xFSSC 22000
14xIFS Food
15xBRC Food
16xIFS Food
17xFSSC 22000
18xIFS Global Markets Food
19xFSSC 22000
20xIFS Food
21xxBRC FoodIFS Food
22xFSSC 22000
23xBRC S&D
24xFSSC 22000
25xxBRC FoodIFS Food
26xxBRC FoodIFS Food
Sheet1
Cell Formulas
RangeFormula
O5:O20,O22:O24,O25:P26,O21:P21O5=FILTER($B$4:$M$4,B5:M5="x")
Cells with Data Validation
CellAllowCriteria
N5:N26List=O5#


Hope this helps.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,660
Messages
6,126,082
Members
449,286
Latest member
Lantern

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