0
votes

I'm not too versed in Excel but I am learning quickly and I'm having trouble with outputting data based upon selection from drop down list. Here's what I'm trying to do. I have build drop-down lists which let the user first select a name, then category and then based upon their category selection, they select from a sub-category. What I want to do is based upon the sub-category they select, I would like to output a string of text based upon values they have selected from the drop down lists.

Example would be the user selects Tom from the drop down name list. User then selects Food from the Category List. User then selects Breakfast from the Sub-Category List (in column B4).

What I would like to do is output a string of text for everything listed under my Breakfast category that I have listed on Sheet2. On Sheet2 under Breakfast, I have the following values: Cereal, Toast, Pancakes (each listed in their own cell). Here's how I would like to have the output displayed on Sheet1:

Tom Cereal
Tom Toast
Tom Pancakes

What is the easiest way for me to achieve this? I tried the following statement:

=IF(B4='Breakfast',Sheet2!Breakfast,"")

What happens is it only outputs Tom Pancakes. How do I make it output each line instead of just the last line? Do I need to use a counter function? Any help would be appreciated!

1
A screenshot of your sheet and your desired result would be very helpful. What kind of dropdown list are they? ActiveX, Data Validation list,...?nbayly
I can post a screen shot this evening but the drop down list is data validation listChris Scott
I couldn't figure out how to screen shot on this website so I linked to hosted snap shots. I'm using Data Validation lists for the drop down lists. Please let me know if you have any more questions and any help would be appreciated.Chris Scott

1 Answers

0
votes

Assuming a max amount of values of 5, starting in B5 to B9 you would place the following array formula:

=IF(indirect("Sheet2!"&SUBSTITUTE(ADDRESS(1,MATCH(B3,Sheet2!1:1,0),4),"1","")&"2:"&SUBSTITUTE(ADDRESS(1,MATCH(B3,Sheet2!1:1,0),4),"1","")&"6")<>"",B1&" "&indirect("Sheet2!"&SUBSTITUTE(ADDRESS(1,MATCH(B3,Sheet2!1:1,0),4),"1","")&"2:"&SUBSTITUTE(ADDRESS(1,MATCH(B3,Sheet2!1:1,0),4),"1","")&"6"),"")

Note that after selecting the 5 cells and placing the formula, you set it as an array formula by pressing CTRL + SHIFT + ENTER. You will confirm it is an array formula when it encloses the formula in curly brackets "{ }".

Formula logic is as follows:

-. Using a MATCH if finds what column in Sheet2 contains the selected sub catergory.

-. ADDRESS then converts the column number into column letter

-. Using INDIRECT it then references the correct column to pull the values into an array from Sheet2.

-. Using this array it first checks if it has any values so that we can exclude any blank cells

-. If the array item is not empty it then concatenates the selected name with each part of the array.

-. If array item is empty it returns a blank cell

Hope this helps you. Regards,