delete and put the matched item into adjacent cell

abdo meghari

Active Member
Joined
Aug 3, 2021
Messages
470
Office Version
  1. 2019
hello
I want matching the items in column B with the items in column H if the items are matched with column B then should put each matched item next to adjacent matched item in column A and delete the others not matched in the same column H .


DL .xlsm
ABCDEFGH
1SrDescriptionQTYLIST
21BS 185/70R13 EP150 INDO184BS 195R14C R623 THI
32BS 185R14C R624 INDO16BS 195R14C 613V JAP
43BS 175/65R14 B250 THI50BS 195R14C R660 TR
54BS 175/65R14 B250 INDO30BS 195/70R14 150 EZ THI
65BS 175/70R14 EP150 THI25BS 205R14C 613V JAP
76BS 165 R13C R624 INDO50BS 205R14C R624 INDO
88BS 165 R13C R624 INDO46BS 215R14C R624 INDO
99BS 175/70R13 B250 INDO1BS 185/65R15 B250 JAP
10BS 185/65R15 T005 INDO
11BS 185/65R15 T01 JAP
12BS 175/65R14 B250 INDO
13BS 175/70R14 EP150 THI
14BS 165 R13C R624 INDO
15BS 185R14C R624 INDO
16BS 175/65R14 B250 THI
17BS 165 R13C R624 INDO
18BS 175/70R13 B250 INDO
19BS 185/70R13 EP150 INDO
20BS 185/70R13 EP150 INDO
purchase


result in column H
DL .xlsm
ABCDEFGH
1SrDescriptionQTYITEMLIST
21BS 185/70R13 EP150 INDO1841BS 185/70R13 EP150 INDO
32BS 185R14C R624 INDO162BS 185R14C R624 INDO
43BS 175/65R14 B250 THI503BS 175/65R14 B250 THI
54BS 175/65R14 B250 INDO304BS 175/65R14 B250 INDO
65BS 175/70R14 EP150 THI255BS 175/70R14 EP150 THI
76BS 165 R13C R624 INDO506BS 165 R13C R624 INDO
87BS 175/70R13 B250 INDO87BS 185/70R13 EP150 INDO
98BS 165 R13C R624 INDO468BS 165 R13C R624 INDO
109BS 175/70R13 B250 INDO19BS 175/70R13 B250 INDO
11
purchase
my list about 1000 items .
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
In your sample it seems that everything in column B appears in column H which means that the column H result is simply a copy of column B.
So, is it possible that an item in column B does not appear in column H?
 
Upvote 0
So, is it possible that an item in column B does not appear in column H?
if you see the picture 2 you will see some items are deleted( should delete item from column H if the items in column B does not appear in column H just keep the matched items in column H based on column B .
 
Upvote 0
sorry about mistake !! also shouldn't be duplicated items in the same column
I hope this fixing the things


DL .xlsm
ABCDEFGH
1SrDescriptionQTYLIST
21BS 185/70R13 EP150 INDO184BS 195R14C R623 THI
32BS 185R14C R624 INDO16BS 195R14C 613V JAP
43BS 175/65R14 B250 THI50BS 195R14C R660 TR
54BS 175/65R14 B250 INDO30BS 195/70R14 150 EZ THI
65BS 175/70R14 EP150 THI25BS 205R14C 613V JAP
76BS 165 R13C R624 INDO50BS 205R14C R624 INDO
88BS 165R13C R624 THI46BS 215R14C R624 INDO
99BS 175/70R13 B250 INDO1BS 185/65R15 B250 JAP
10BS 185/65R15 T005 INDO
11BS 185/65R15 T01 JAP
12BS 175/65R14 B250 INDO
13BS 175/70R14 EP150 THI
14BS 165 R13C R624 THI
15BS 185R14C R624 INDO
16BS 175/65R14 B250 THI
17BS 165 R13C R624 INDO
18BS 175/70R13 B250 INDO
19BS 185/70R13 EP150 INDO
20BS 185/70R13 EP150 THI
purchase




DL .xlsm
ABCDEFGH
1SrDescriptionQTYITEMLIST
21BS 185/70R13 EP150 INDO1841BS 185/70R13 EP150 INDO
32BS 185R14C R624 INDO162BS 185R14C R624 INDO
43BS 175/65R14 B250 THI503BS 175/65R14 B250 THI
54BS 175/65R14 B250 INDO304BS 175/65R14 B250 INDO
65BS 175/70R14 EP150 THI255BS 175/70R14 EP150 THI
76BS 165 R13C R624 INDO506BS 165 R13C R624 INDO
88BS 165 R13C R624 THI468BS 165 R13C R624 THI
99BS 175/70R13 B250 INDO19BS 175/70R13 B250 INDO
purchase
 
Upvote 0
Despite asking twice, you still have not answered my question ( :( ) so I expect this is not what is actually required. However, it does produce your expected result from your sample data.

VBA Code:
Sub IExpectThisIsNotWhatIsRequired()
  Range("A2:B" & Range("H" & Rows.Count).End(xlUp).Row).Copy Destination:=Range("G2")
End Sub
 
Upvote 0
Despite asking twice, you still have not answered my question
sorry ! I try to answer you but seem I misunderstand you . now I knew it why you ask this after test the code
based on your question yes. and based on your code add new item to column H shouldn't add it .
 
Upvote 0
see the items in rows 2,11 in column B

DL (version 1).xlsb
ABCDEFGH
1SrDescriptionQTYLIST
21BS 185/70R13 EP150 INDO184BS 195R14C R623 THI
32BS 1200R20 G580 JAP200BS 195R14C 613V JAP
43BS 185R14C R624 INDO16BS 195R14C R660 TR
54BS 175/65R14 B250 THI50BS 195/70R14 150 EZ THI
65BS 175/65R14 B250 INDO30BS 205R14C 613V JAP
76BS 175/70R14 EP150 THI25BS 205R14C R624 INDO
87BS 165 R13C R624 INDO50BS 215R14C R624 INDO
98BS 165R13C R624 THI46BS 185/65R15 B250 JAP
109BS 175/70R13 B250 INDO1BS 185/65R15 T005 INDO
1110BS 1400R20 VSJ TCF JAP20BS 185/65R15 T01 JAP
12BS 175/65R14 B250 INDO
13BS 175/70R14 EP150 THI
14BS 165 R13C R624 THI
15BS 185R14C R624 INDO
16BS 175/65R14 B250 THI
17BS 165 R13C R624 INDO
18BS 175/70R13 B250 INDO
19BS 185/70R13 EP150 INDO
20BS 185/70R13 EP150 THI
purchase



DL (version 1).xlsb
ABCDEFGH
1SrDescriptionQTYITEMLIST
21BS 185/70R13 EP150 INDO1841BS 185/70R13 EP150 INDO
32BS 1200R20 G580 JAP200
42BS 185R14C R624 INDO162BS 185R14C R624 INDO
53BS 175/65R14 B250 THI503BS 175/65R14 B250 THI
64BS 175/65R14 B250 INDO304BS 175/65R14 B250 INDO
75BS 175/70R14 EP150 THI255BS 175/70R14 EP150 THI
86BS 165 R13C R624 INDO506BS 165 R13C R624 INDO
98BS 165 R13C R624 THI468BS 165 R13C R624 THI
109BS 175/70R13 B250 INDO19BS 175/70R13 B250 INDO
1110BS 1400R20 VSJ TCF JAP20
purchase
 
Upvote 0
In the results mini-sheet ..
  • Why is cell A4 = 2 when in the original data cell A4 = 3?
  • Why is cell G4 = 3 when the original data has 2 for BS 185R14C R624 INDO?
  • In cell H9, where did the BS 165 R13C R624 THI come from? I can't see that value anywhere in H2:H20 of the original data.
 
Upvote 0

Forum statistics

Threads
1,216,070
Messages
6,128,612
Members
449,460
Latest member
jgharbawi

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