Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Return first occurence of match, return the next match on next occurence

Posted on 2016-10-21
Medium Priority
42 Views
I have attached a spreadsheet here to demonstrate what I'm trying to do.

I have a list, with a department number and an employee name on one spreadsheet.  More than one employee may work in a department.

I need to have each person who matches a department show up , I've tried a Vlookup formula however this only returns the first person,  I also tried a match formula,  any assistance would be greatly appreciated!
Test-Payroll-Automation.xlsx
0
Question by:jgreenlee01
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 3
• 3

LVL 27

Expert Comment

ID: 41854716
use this formula, it is array formula so enter it with special key stroke of Control + Shift +Enter

see attached

=IFERROR(INDEX(Sheet2!\$B\$2:\$B\$9,SMALL(IF(Sheet1!B9=Sheet2!\$A\$2:\$A\$9,ROW(Sheet2!\$B\$2:\$B\$9)-ROW(Sheet2!\$B\$2)+1),ROWS(Sheet2!\$A\$2:A2))),"")
Test-Payroll-Automation.xlsx
0

Author Comment

ID: 41854726
Hi Professor JimJam,

Thank you,

When I apply this solution to the larger spreadsheet I am not getting the right names produced by the formula.  A random name appears to show up.  What could I be misapplying?
0

Author Comment

ID: 41854734
This is what my formula looks like when converted to work for the larger spreadsheet

0

Author Comment

ID: 41856258
On the test sheet that is attached to the original question, the return appears to be 0 with the Ctrl Shift Enter.
0

LVL 27

Accepted Solution

ProfessorJimJam earned 2000 total points (awarded by participants)
ID: 41856782
put this formula in C9 and copy down

=IFERROR(INDEX(MyData[Payroll Name],SMALL(IF('Main Street'!B9=MyData[Worked In Department],ROW(MyData[Payroll Name])-ROW('ADP Hours Worked by Dept Report'!\$B2)+1),COUNTIF('Main Street'!\$B\$9:\$B9,'Main Street'!\$B9))),"")
0

LVL 27

Expert Comment

ID: 41884547
.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand â€“ and conveys the hard lessons his company learned in the aftermath.
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on tâ€¦
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increasedâ€¦
###### Suggested Courses
Course of the Month8 days, 20 hours left to enroll