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:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
To sort data as it is, just use the AUTOFILTER found on the DATA ribbon.

If you want to have a filtered report, you can use the Advanced Filter also on the DATA ribbon.

If you want to filter with a formula, you could try this:
(This requires you to allocate enough rows to accomodate the maximum number of occurances of the look up value).

Mr excel questions 47.xlsm
ABCDEFGHIJ
1DATECODEINV-N.OCLIENT-N.OBRANDTYPEORGINQTYPRICETOTAL
2Wednesday, January 4, 2023A02BlS1/12-021CC-MMSN1/12AC-AD1AA-100TTY1101401400
3Tuesday, May 4, 2021A03BlS1/12-022CC-MMSN1/13AC-AD2AA-101TTY2122002400
4Friday, April 23, 2021A04BlS1/12-023CC-MMSN1/14AC-AD3AA-102TTY3161302080
5Sunday, April 4, 2021A02BlS1/12-024CC-MMSN1/15AC-AD1AA-100TTY1101461460
6Monday, June 14, 2021A03BlS1/12-025CC-MMSN1/16AC-AD2AA-101TTY2122002400
7Tuesday, April 13, 2021A02BlS1/12-026CC-MMSN1/17AC-AD3AA-102TTY3161442304
8
9
10
11
12CODEA02
13Sunday, April 4, 2021A02BlS1/12-024CC-MMSN1/15AC-AD1AA-100TTY1101461460
14Tuesday, April 13, 2021A02BlS1/12-026CC-MMSN1/17AC-AD3AA-102TTY3161442304
15Wednesday, January 4, 2023A02BlS1/12-021CC-MMSN1/12AC-AD1AA-100TTY1101401400
mussa
Cell Formulas
RangeFormula
J2:J7J2=I2*H2
A13:A15A13=IF(COUNTIF($B$2:$B$7,$B$12)<ROWS($A$13:A13),"",1/(LARGE(1/($A$2:$A$7)*(--($B$12=$B$2:$B$7)),ROWS($A$13:A13))))
B13:J15B13=INDEX($B$2:$J$7,MATCH($A13&$B$12,$A$2:$A$7&$B$2:$B$7,0),0)
Dynamic array formulas.
 
Upvote 0
thanks, but as I said
my real data about 6700 rows .
I don't only autofilter couldn't succeed . I think need more than of that like array with autofilter by vba
 
Upvote 0
Okay, I understand your requirement better. But tell me... why do you want to have to page through 6700 or more records to find the group of CODES that you want to have as your primary sort? You'd be paging down or using the find function quite a bit which is time consuming.

The advanced filter or the formula I suggested may be a more efficient solution for your question. If you are filtering "raw" data I think it is messing with fire as you can corrupt your source data with an inadvertant (or improperly selected) sort.

If you have access to Excel 365 or Excel 2021(Maybe) you would be able to use the FILTER function which is a great new addition.

Best Wishes.
 
Upvote 0
why do you want to have to page through 6700 or more records to find the group of CODES that you want to have as your primary sort?
I have macro to populate all records 6700 rows from all of sheets and put in one sheet as in OP when populate data will not arrange duplicates items under each other so I search for macro to do that from old date to last date .
You'd be paging down or using the find function quite a bit which is time consuming.
I have another macro to search item without paging down.
If you are filtering "raw" data I think it is messing with fire as you can corrupt your source data with an inadvertant (or improperly selected) sort.
this is the first time body doesn't advice use filter data!:unsure:
If you have access to Excel 365 or Excel 2021(Maybe) you would be able to use the FILTER function which is a great new addition.
based on my account detail of course not .
or the formula I suggested may be a more efficient solution for your question
obviously vba is not available so far, so I will test your formula and see how goes.
 
Upvote 0
If you are filtering "raw" data I think it is messing with fire as you can corrupt your source data with an inadvertant (or improperly selected) sort.


this is the first time body doesn't advice use filter data!

I think you misunderstood. Or least I hope you did.

With autofilter and/or some data models it may not be such a problem. But, it seems you aren't using those from your comments.


If you have COLUMNS A:ZZ and you want to sort or filter based on something in column MM and you do not select the entire range A##:ZZ## then you will be misaligning your rows. AND if that is RAW DATA (the only true and factual source of your information) you will permanently and utterly destroy your company's work if you have no back up.

I encourage all excel users I work with to NEVER EVER filter or sort RAW DATA worksheets/ranges/tables.


Please let me know the results of the formula I suggested. I am well aware it deviates from your desired process. If it doesn't work, I wish you the best of luck in finding a solution here. Mr. Excel is a great resource and I'm sure there are folks that have a great solution for you. And some that may even disagree with what I wrote above.
 
Upvote 0
doesn't see to be work the formula, it shows error #VALUE!
 
Upvote 0
doesn't see to be work the formula, it shows error #VALUE!
Try committing the formula with the CNTL-SHFT-ENTR key stroke.

If that doesn't work then you'll need to figure a way to send a mini worksheet. As you can see it works for me.
 
Upvote 0
thanks , what about the rest of the data?
what do you mean?


Did you enter the formula with CNTL-SHFT-ENTR keystroke? Did you copy it down your columns?

Again, if you still get an error you need to figure out how you can get us what exact formula you used and what exact cell references and contents you used.

we can't debug "I get a #VALUE error".
 
Upvote 0

Forum statistics

Threads
1,215,148
Messages
6,123,301
Members
449,095
Latest member
Chestertim

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