Return unique values based on multiple conditions and sorted by date

emoandy05

Board Regular
Joined
Sep 4, 2013
Messages
60
Hello,

I have data similar to whats shown in the "Orig Data' table. I would like to pull unique Names only, based on two criteria (Start Date <= today AND End Date >= today. I would also like the data sorted (oldest to newest) based on the Name's corresponding End Date . My goal is to have a table similar to the 'Result' table below. I do not necessarily need the End Dates to be in an adjacent column, just need the Names sorted.

All duplicate Names will have the same Start Date and End Date.

Thank you very much in advance!


Orig Data
NameStart DateEnd Date
333​
20-Nov​
24-Nov​
333​
20-Nov​
24-Nov​
444​
25-Nov​
10-Dec​
444​
25-Nov​
10-Dec​
555​
24-Nov​
5-Dec​
111​
20-Nov​
20-Dec​
111​
20-Nov​
20-Dec​
222​
26-Nov​
26-Dec​

Result
NameEnd Date
555​
5-Dec​
444​
10-Dec​
111​
20-Dec​
222​
26-Dec​
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
That's easy with the new functions in Excel 365 Insider, UNIQUE and SORT.
Which version of Excel are you using?
 
Upvote 0
Without the new functions, you can do it like this:

Book1
ABCDEF
1Orig DataResult
2NameStart DateEnd DateNameEnd Date
333311/20/201911/24/201955512/5/2019
433311/20/201911/24/201944412/10/2019
544411/25/201912/10/201911112/20/2019
644411/25/201912/10/201922212/26/2019
755511/24/201912/5/2019  
811111/20/201912/20/2019  
911111/20/201912/20/2019  
1022211/26/201912/26/2019
11
Sheet3
Cell Formulas
RangeFormula
E3:E9E3=IFERROR(INDEX(A:A,MOD(AGGREGATE(15,6,($C$3:$C$10*1000+ROW($C$3:$C$10))/(COUNTIF($E$2:$E2,$A$3:$A$10)=0)/($B$3:$B$10<=TODAY())/($C$3:$C$10>=TODAY()),1),1000)),"")
F3:F9F3=IF(E3<>"",INDEX($C$3:$C$10,MATCH(E3,$A$3:$A$10,0)),"")
 
Upvote 0

Forum statistics

Threads
1,224,747
Messages
6,180,710
Members
452,994
Latest member
Janick

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