Search and Return ALL found values. HELP!

aepadilla2

New Member
Joined
Nov 16, 2015
Messages
1
[h=1]I need your help to develop an Excel formula that will look up a value and return ALL found values in a separate worksheet.

I have the following database and I will like to separate all employees with the same job title in a different worksheet.

(I've tried VLOOKUP and ARRAY formulas with no luck). Anything helps thank you very much!

6fs2ah.png
[/IMG][/h]
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Welcome to the forum!

Here's an option. Here's a small subset of your sample:
Excel 2010
ABCDEF
1Emp IDLegal NameManagerTitleShiftHire date
2ReneDavidPLANT MANAGER II
3MARTHAROBINHUMAN RESOURCE MANAGER II
4101566ARTUROKIMSTORE ROOM ATTENDANT11/14/2007
5103246JESUSRUBENSORTER5/5/2008
6113379ALFREDKIMSTORE ROOM ATTENDANT3/5/2012

<tbody>
</tbody>
Sheet1


And on Sheet2, here's what it looks like:
Excel 2010
ABCDEFGHI
1STORE ROOM ATTENDANTIDNAMEMANAGERTITLESHIFTHIREON-LEAVE
24101566ARTUROKIMSTORE ROOM ATTENDANT0394000
36113379ALFREDKIMSTORE ROOM ATTENDANT0409730

<tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
C2=IFERROR(INDEX(Sheet1!A$1:A$100,$B2),"")

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
B2{=IFERROR(AGGREGATE(15,3,IF(Sheet1!$D$2:$D$100=$A$1,ROW($D$2:$D$100),NA()),ROW()-ROW($B$2)+1),"")}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



In A1 on Sheet2, put the title you're looking for. Put the array formula in B2, confirm with Control-Shift-Enter. Then copy it and paste it down the column. Then take the regular formula in C2, copy it, and paste it through the rest of your range C2:I100 (or whatever). Change the bottom row in the formulas too. You can hide column B if you like. This formula requires Excel 2010 or later. Let me know how it works.
 
Last edited:
Upvote 0
If you can use VBA, This might work. copy to standar code module 1.
Code:
Sub likeEmpList()
Dim sh As Worksheet
Set sh = Sheets("Sheet1")
    With sh
        .Range("D3", .Cells(Rows.Count, 4).End(xlUp)).AdvancedFilter xlFilterCopy, , .Cells(Rows.Count, 1).End(xlUp)(3), True
        For Each c In .Range(.Cells(Rows.Count, 1).End(xlUp), .Cells(Rows.Count, 1).End(xlUp).End(xlUp)(2))
            .UsedRange.Offset(2).AutoFilter 4, c.Value
            Sheets.Add After:=Sheets(Sheets.Count)
            .UsedRange.Offset(3).SpecialCells(xlCellTypeVisible).EntireRow.Copy ActiveSheet.Range("A2")
            .Rows(1).Copy ActiveSheet.Range("A1")
            ActiveSheet.Name = c.Value
            .AutoFilterMode = False
        Next
    End With
End Sub
 
Upvote 0
JLGWhiz's code sparked a thought. You don't need formulas or VBA if you don't want. You can filter your table by job title, then copy the visible rows, then paste those to another sheet. Very quick.
 
Upvote 0

Forum statistics

Threads
1,216,756
Messages
6,132,533
Members
449,733
Latest member
Nameless_

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