# Excel Data Validation List Macro or Formula Help

Hello,

Please see attached sample.  Im hoping someone can recommend either a formula or a macro that will do the following:

Once a position is selected from the data validation drop down list in sheet1, the person/s name and salary will populate starting in columns B15 and C15.  For example, if Waterboy is selected, both John Doe and Brad Pitt's name and salary would appear.  If quarterback is selected, the names would clear and only Tom Cruise's name and salary would appear.

Thank you for any assistance in advance!
EE-Sample.xlsx
LVL 1
###### 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.

EngineerCommented:
Try this macro. Make sure that the spelling of Quarterback is the same in both sheets.

To install the macro
Right click on the sheet tab name of sheet1
select view code
paste the macro given below in the code pane

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cel As Range
Application.EnableEvents = False
Range("B15:c" & Rows.Count).ClearContents
With Sheets("Filled Position Data")
For Each cel In .Range("E2:E" & .Range("E" & Rows.Count).End(xlUp).Row)
If cel.Value = Target.Cells(1, 1).Value Then
Range("B" & Rows.Count).End(xlUp).Offset(1, 1) = cel.Offset(, 12)
Range("B" & Rows.Count).End(xlUp).Offset(1, 0) = cel.Offset(, 6)
End If
Next cel
End With
End If
Application.EnableEvents = True
End Sub
0

Experts Exchange Solution brought to you by

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

Author Commented:
One slight change.  If the names in the Filled Position data sheet are actually in column E how would I adjust this macro?
0
Author Commented:
Sorry I mean in Column P.  Not E.
0
EngineerCommented:
cel is where the position is

cel.Offset(, 6) means 6 cells to the right of cel

cel.Offset(, 12) means 12 cells to the right of cel

You can change the value of 6 or 12 by counting the columns to the right of the position cell
0
Author 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.