• 464K Members
• 9,523 Online
• 561K Conversations
SOLVED

Senior Member

# Filter row if another row exists below

Tricky filter help needed, was hard enough to even search for.

What i have is a table of employees who are entering and leaving the building. What i need to do is get a list of employees who are IN the building, so basically removing them from the list if they are marked as OUT and not IN again. This is so HR can see who is in the building right now.

The table looks like this:

 2671059 16/08/2019 9:34 Joe Bloggs West Door OUT 2671056 16/08/2019 9:26 Jane Fonda West Door IN 2671053 16/08/2019 9:19 Corey Feldman West Door IN 2671050 16/08/2019 9:18 Joe Bloggs West Door IN 2671047 16/08/2019 9:18 Jane Fonda East Door OUT 2671044 16/08/2019 9:17 Jane Fonda West Door IN

So i would need to get a filtered list showing Jane Fonda and Corey Feldman, as Joe Bloggs most recent action was to leave and therefore not in the building.

2 Replies

# Re: Filter row if another row exists below

HI @Erron00

You can achieve required filter by adding a support column and putting below formula in it:

=RIGHT(INDEX(\$D\$2:\$D\$7,MATCH(MAX(INDEX(\$B\$2:\$B\$7,MATCH(C2,\$C\$2:\$C\$7,0))),\$B\$2:\$B\$7,0)),3)

If you select Joe Bloggs it will show him out in column E.

A sample file is also attached for your reference.

Please let me know if it works for you.

Tauqeer

Solution

# Re: Filter row if another row exists below

I would observe that your data is sorted by time of the action.  Therefore you simply need to search for the first occurrence of each UserName in the table and return the associated Action. For a Dynamic Array version of Excel the list of distinct names is given by the formula 'UserName' that refers to

= SORT( UNIQUE( EntryLog[UserName] ) )

where the structured references are given by  converting the data to an Excel Table that I have named 'EntryLog'.  For a traditional version of Excel such a list can be created manually with little inconvenience.

The last action for each person is given by

= INDEX( RIGHT(EntryLog[Action],3),

With traditional Excel this column would be used to filter the list of distinct names.

With DA, however, this can be simplified to create a filtered list of staff currently on site directly

INDEX( RIGHT( EntryLog[Action], 2 ) = "IN",

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies