Delete duplicate value for same date and other look up value.

teziboy

New Member
Joined
Nov 4, 2019
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Dear All,

I was trying to delete the duplicate values which comes from XLOOKUP formula but is same for several dates.
For example, in attached file, In column C, HCFT comes from the Xlookup on Column B.
However, the value in Column C is repetitive for the same date.
I am looking for a VBA to remove the repetitive HCFT only (not all the rows) for the same date and Vehicle number.
My objective is to remove the colored values using VBA in Column C since those are equals to same date same vehicle.
Could you please help me to sort the problem?
Thanks in advance.


Shotez
 

Attachments

  • Capterfeure.JPG
    Capterfeure.JPG
    93.6 KB · Views: 18

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

So that helpers do not have to manually type sample data:
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Could you simply adjust your formula instead of resorting to vba?

22 03 20.xlsm
ABCDEFG
1
21/01/20221198831300
31/01/2022119883 2073721300
41/01/2022119883 1816851300
51/01/202220737213001198821300
61/01/2022207372 1198831300
71/01/2022207372 
81/01/2022207372 
91/01/20221816851300
101/01/2022181685 
111/01/2022181685 
121/01/2022181685 
XLOOKUP
Cell Formulas
RangeFormula
C2:C12C2=IF(AND(A2=A1,B2=B1),"",XLOOKUP(B2,F$3:F$6,G$3:G$6))
 
Upvote 0
Solution
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Delete duplicate value for same date and other look up value.
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

So that helpers do not have to manually type sample data:
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Could you simply adjust your formula instead of resorting to vba?

22 03 20.xlsm
ABCDEFG
1
21/01/20221198831300
31/01/2022119883 2073721300
41/01/2022119883 1816851300
51/01/202220737213001198821300
61/01/2022207372 1198831300
71/01/2022207372 
81/01/2022207372 
91/01/20221816851300
101/01/2022181685 
111/01/2022181685 
121/01/2022181685 
XLOOKUP
Cell Formulas
RangeFormula
C2:C12C2=IF(AND(A2=A1,B2=B1),"",XLOOKUP(B2,F$3:F$6,G$3:G$6))
Thank you so much Peter :)
 
Upvote 0
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Delete duplicate value for same date and other look up value.
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
Hi Fluff,

Duly noted.
The post is also at Delete duplicate value for same date and other look up value.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,557
Members
449,088
Latest member
davidcom

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