Forum Discussion

Fahad Qamar's avatar
Fahad Qamar
Copper Contributor
Apr 22, 2018

Extracting data in the new sheet

the attached excel sheet contain 3 columns

 

i want to extract the rows for every (customer no) with the oldest dates

for instance for customer no: 345467 i need 

221/04/2018345467
320/04/2018345467

on the sheet 2

for customer no 321450

i need to extract 

519/04/2018321450

and so on 

 

for more clarification if there are 5 records saves for each customer no i need to extract the oldest four in a new sheet if there are 4 records for any customer no i need to extract the oldest 3 ....

 

 

 

Reciept No | Date | Customer No

122/04/2018345467
221/04/2018345467
320/04/2018345467
420/04/2018321450
519/04/2018321450
616/04/201832134
715/04/2018111111
815/04/2018111111
914/04/2018111111

2 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Hi,

     

    That could be done with Power Query (add-in for 2010, 2013, built-in in 2016 as Get&Transform)

    - first query loads all receipts

    -duplicate it in second query, sort by customer and date and remove duplicates keeping only newest receipts for each customer

    - left anti join first query with second one, land the result into any place in workbook

     

    Please see attached

Resources