Populating multiple rows from one sheet to another

gsrlb

New Member
Joined
Jun 6, 2018
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am trying to populate a sheet B based on EMPID from Sheet A. I am doing this using VLOOKUP. Please see details of Sheet A (a sample) as below.



EMPIDNameProject NameDivision
EMPID1Name1Project Name1Division1
EMPID2Name2Project Name2Division2
EMPID1Name1Project Name2Division3
EMPID1Name1Project Name3Division3
EMPID3Name3Project Name1Division2
EMPID2Name2Project Name2Division1
EMPID3Name3Project Name4Division4
EMPID4Name4Project Name5Division5
EMPID5Name5Project Name3Division1


However, when I use VLOOKUP to lookup based on EMPID, I am not able to populate all rows. Say for example, when I lookup using EMPID for EMPID1, I wanted to ensure all rows for EMPID1 (all projects that EMPID1 is assigned to) are populated and not just the first match.

Please advise how can I achieve this?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I think you will need a VBA
VBA Code:
Sub MM3()
Dim ans As String
ans = InputBox("which text do you want to copy")
 With Sheets("Sheet A").UsedRange
            .AutoFilter
            .AutoFilter field:=1, Criteria1:=ans
            .Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).Copy Sheets("Sheet B").Range("A1")
            .AutoFilter
    End With
End Sub
 
Upvote 0
What version of Excel are you using?
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Thank you @Fluff. I'm using O365.
 
Upvote 0
Thanks for that.
A formula solution
Fluff.xlsm
ABCD
1
2EMPID1
3
4EMPID1Name1Project Name1Division1
5EMPID1Name1Project Name2Division3
6EMPID1Name1Project Name3Division3
7
Sheet2
Cell Formulas
RangeFormula
A4:D6A4=FILTER(Sheet1!A2:D200,Sheet1!A2:A200=B2)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,210
Members
453,023
Latest member
alabaz

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