Excel 2007 Formula to Pull Range of Data Based on Drop Down Selection

Please see attached as an example.  I am looking for a formula that looks at what is selected in the drop down cell (B3) and will pull all of the elements of the description on sheet 2.  For example, if Peach is selected on sheet 1 then two cells in column C would show Fuzzy and Pit.  If Apple is selected, then 3 cells to the right of the drop down in column C would show Red, Sweet and Cooking.  If a VB code is required that works too.

Thanks!!!
EE-Example.xlsx
LVL 1
EscanabaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
try:

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Row = 3 And Target.Column = 2 Then
        Range("C3:C1000").ClearContents
        lastRow = Sheets("Sheet2").Cells(Rows.Count, "D").End(xlUp).Row
        j = 3
        
        For i = 2 To lastRow
            If Sheets("Sheet2").Cells(i, 3) <> "" Then
                v = Sheets("Sheet2").Cells(i, 3)
            End If
            If v = Target.Value Then
                Cells(j, 3) = Sheets("Sheet2").Cells(i, 4)
                j = j + 1
            End If
        Next
    End If
End Sub

Open in new window

0
Roy CoxGroup Finance ManagerCommented:
Why would Peach have two cells in Column C, butApple would have details on a Row?
0
Ryan ChongCommented:
is this what you mean?
EE-Example-b.xlsm
1
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

EscanabaAuthor Commented:
Ryan - That appears to be spot on.  What would I change in your code to move the description results to a different column/cell?  For example, if I wanted the results to appear starting in cell B6.
0
Roy CoxGroup Finance ManagerCommented:
Is this what you mean using formulas
EE-Example.xlsx
0
Ryan ChongCommented:
>>For example, if I wanted the results to appear starting in cell B6.

try:

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Row = 3 And Target.Column = 2 Then
        Range("B6:B1000").ClearContents
        lastRow = Sheets("Sheet2").Cells(Rows.Count, "D").End(xlUp).Row
        j = 6
       
        For i = 2 To lastRow
            If Sheets("Sheet2").Cells(i, 3) <> "" Then
                v = Sheets("Sheet2").Cells(i, 3)
            End If
            If v = Target.Value Then
                Cells(j, 2) = Sheets("Sheet2").Cells(i, 4)
                j = j + 1
            End If
        Next
    End If
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
EscanabaAuthor Commented:
Thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.