filter data from old date to last date based on duplicates items

Mussa

Board Regular
Joined
Jul 12, 2021
Messages
241
Office Version
  1. 2019
  2. 2010
Hello
I have duplicates items in column B . what I want filter data from old date to last date based on date in column A for each duplicates item in column B
the date will be MM/DD/YYYY
the original data
df.xlsm
ABCDEFGHIJ
1DATECODEINV-N.OCLIENT-N.OBRANDTYPEORGINQTYPRICETOTAL
204/01/2023A02BlS1/12-021CC-MMSN1/12AC-AD1AA-100TTY1101401400
304/05/2021A03BlS1/12-022CC-MMSN1/13AC-AD2AA-101TTY2122002400
404/23/2021A04BlS1/12-023CC-MMSN1/14AC-AD3AA-102TTY3161302080
504/04/2021A02BlS1/12-024CC-MMSN1/15AC-AD1AA-100TTY1101461460
606/14/2021A03BlS1/12-025CC-MMSN1/16AC-AD2AA-101TTY2122002400
704/13/2021A02BlS1/12-026CC-MMSN1/17AC-AD3AA-102TTY3161442304
sh1
Cell Formulas
RangeFormula
J2:J7J2=I2*H2

what I want it


df.xlsm
ABCDEFGHIJ
1DATECODEINV-N.OCLIENT-N.OBRANDTYPEORGINQTYPRICETOTAL
204/04/2021A02BlS1/12-024CC-MMSN1/15AC-AD1AA-100TTY1101461460
304/13/2021A02BlS1/12-026CC-MMSN1/17AC-AD3AA-102TTY3161442304
404/01/2023A02BlS1/12-021CC-MMSN1/12AC-AD1AA-100TTY1101401400
504/05/2021A03BlS1/12-022CC-MMSN1/13AC-AD2AA-101TTY2122002400
606/14/2021A03BlS1/12-025CC-MMSN1/16AC-AD2AA-101TTY2122002400
704/23/2021A04BlS1/12-023CC-MMSN1/14AC-AD3AA-102TTY3161302080
sh1
Cell Formulas
RangeFormula
J2:J7J2=I2*H2

my real data about 6700 rows .
thanks
 
Last edited:
yes your formula work as you guided me, but based on OP should filter the whole range , and your formula just gave me date and the code without the others columns , should populate the whole row for each duplicates item.
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You keep mentioning filter, but you seem to want a simple sort on 2 columns? If that's the case, try the following:
VBA Code:
Option Explicit
Sub Mussa()
    Dim ws As Worksheet
    Set ws = Worksheets("sh1")      '<~~ *** Change to actual sheet name ***
    ws.Range("A1").CurrentRegion.Sort Key1:=ws.Range("B1"), order1:=xlAscending, _
    Key2:=ws.Range("A1"), order2:=xlAscending, Header:=xlYes
End Sub

Before:
Book1
ABCDEFGHIJ
1DATECODEINV-N.OCLIENT-N.OBRANDTYPEORGINQTYPRICETOTAL
204/01/2023A02BlS1/12-021CC-MMSN1/12AC-AD1AA-100TTY1101401400
304/05/2021A03BlS1/12-022CC-MMSN1/13AC-AD2AA-101TTY2122002400
404/23/2021A04BlS1/12-023CC-MMSN1/14AC-AD3AA-102TTY3161302080
504/04/2021A02BlS1/12-024CC-MMSN1/15AC-AD1AA-100TTY1101461460
606/14/2021A03BlS1/12-025CC-MMSN1/16AC-AD2AA-101TTY2122002400
704/13/2021A02BlS1/12-026CC-MMSN1/17AC-AD3AA-102TTY3161442304
sh1
Cell Formulas
RangeFormula
J2:J7J2=I2*H2


After:
Book1
ABCDEFGHIJ
1DATECODEINV-N.OCLIENT-N.OBRANDTYPEORGINQTYPRICETOTAL
204/04/2021A02BlS1/12-024CC-MMSN1/15AC-AD1AA-100TTY1101461460
304/13/2021A02BlS1/12-026CC-MMSN1/17AC-AD3AA-102TTY3161442304
404/01/2023A02BlS1/12-021CC-MMSN1/12AC-AD1AA-100TTY1101401400
504/05/2021A03BlS1/12-022CC-MMSN1/13AC-AD2AA-101TTY2122002400
606/14/2021A03BlS1/12-025CC-MMSN1/16AC-AD2AA-101TTY2122002400
704/23/2021A04BlS1/12-023CC-MMSN1/14AC-AD3AA-102TTY3161302080
sh1
Cell Formulas
RangeFormula
J2:J7J2=I2*H2
 
Upvote 1
Solution
great !
indeed I don't expect little lines could achieve it .I expect need writing many lines for the code.
but you seem to want a simple sort on 2 columns?
I don't know what the difference filter and sort ! :unsure:
but will give same result , the only different is way of writing the code that what I think
anyway thank you so much for your help.;)
 
Upvote 0
great !
indeed I don't expect little lines could achieve it .I expect need writing many lines for the code.

I don't know what the difference filter and sort ! :unsure:
but will give same result , the only different is way of writing the code that what I think
anyway thank you so much for your help.;)
Glad we could help Mussa, and thanks for the feedback (y) :)
 
Upvote 0

Forum statistics

Threads
1,215,133
Messages
6,123,234
Members
449,092
Latest member
SCleaveland

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