clear cells for duplicates items for list and sort by adjacent cells for another list

abdo meghari

Well-known Member
Joined
Aug 3, 2021
Messages
612
Office Version
  1. 2019
Hello
I want matching column CODE between two lists (A,E) should clear all of items are existed in A:B but not existed in E: F and sort list A: B based on list E:F ,and if items are existed in A:B and existed in E: F when sort list A: B based on list E:F should delete duplicates items from list A:B when sorting
and when sort list A:B should copy from list E:F contains empty cells for column E to list A:B . so should put two lists for adjacent cells each other of them are matched ( the same code) based on code (A,E) when sorting.


original
FILL.xlsm
ABCDEF
1CODEBRANDCODEBRAND
2BSJ100BS 1200R20 G580 JAPBSJ103BS 1200R20 R187 JAP
3BSJ100BS 1200R20 G580 JAPBSJ104BS 1200R20 R187 THI
4BSJ100BS 1200R20 G580 JAPBSJ105BS 1200R24 22PR G580
5BSJ100BS 1200R20 G580 JAPBS 1200R20 G580 TCF
6BSJ100BS 1200R20 G580 JAPBS 1200R24 G582 JAP
7BSJ101BS 1200R20 G580 THIBSJ107BS 1400R20 R180 JAP
8BSJ101BS 1200R20 G580 THIBS 1400R20 TCF 20PR R180BZ JAP
9BSJ101BS 1200R20 G580 THIBSJ109BS 1400R20 VSJ TCF JAP
10BSJ102BS 1200R24 G582 JAPBSJ110BS 155R12C R624 IND
11BSJ102BS 1200R24 G582 JAP
12BSJ102BS 1200R24 G582 JAP
13BSJ102BS 1200R24 G582 JAP
14BSJ103BS 1200R20 R187 JAP
15BSJ103BS 1200R20 R187 JAP
16BSJ104BS 1200R20 R187 THI
17BSJ105BS 1200R24 G580 JAP
18BSJ105BS 1200R24 G580 JAP
19BSJ106BS 13R22.5 R187 JAP
20BSJ107BS 1400R20 R180 JAP
21BSJ107BS 1400R20 R180 JAP
22BSJ108BS 1400R20 R180BZ JAP
23BSJ109BS 1400R20 VSJ JAP
24BSJ109BS 1400R20 VSJ JAP
25BSJ109BS 1400R20 VSJ JAP
26BSJ110BS 155R12C R624 INDO
27BSJ111BS 155R12C R623 INDO
MAIN


result
FILL.xlsm
ABCDEF
1CODEBRANDCODEBRAND
2BSJ103BS 1200R20 R187 JAPBSJ103BS 1200R20 R187 JAP
3BSJ104BS 1200R20 R187 THIBSJ104BS 1200R20 R187 THI
4BSJ105BS 1200R24 G580 JAPBSJ105BS 1200R24 22PR G580
5BS 1200R20 G580 TCFBS 1200R20 G580 TCF
6BS 1200R24 G582 JAPBS 1200R24 G582 JAP
7BSJ107BS 1400R20 R180 JAPBSJ107BS 1400R20 R180 JAP
8BS 1400R20 TCF 20PR R180BZ JAPBS 1400R20 TCF 20PR R180BZ JAP
9BSJ109BS 1400R20 VSJ TCF JAPBSJ109BS 1400R20 VSJ TCF JAP
10BSJ110BS 155R12C R624 INDBSJ110BS 155R12C R624 IND
RESULT

thanks in advance
 
Last edited:

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
OK modify this line:
VBA Code:
Worksheets("MAIN").Copy
like this:
VBA Code:
Worksheets("MAIN").Copy After:=Worksheets("MAIN")
Yes I think you are right. It copies the sheet to a new WB if you don't explicitly indicate before or after which sheet.
 
Upvote 0

Forum statistics

Threads
1,223,710
Messages
6,174,019
Members
452,542
Latest member
Bricklin

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