VBA Macro to Find Missing and Duplicate Data

QuillPet

New Member
Joined
Oct 4, 2023
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hello,

I need a VBA code that will find the missing values in Sheet2 based on Sheet1, i.e., data in Sheet1 but not in sheet2. Afterward, I want to see the data in another sheet as given in the attached mini sheets. Also, I want to find out the duplicate values of Sheet1 and Sheet2. Can anyone create a VBA code to do so?

Much appreciation in advance!

Sheet1 Data:
Compare between 2 Sheets.xlsm
ABC
1BSA Agent X 20" Blue Pink4
2BSA Champ 16" Green2
3BSA Champ 16" Red4
4BSA Champ 16" Victor Blue2
5BSA Champ 20" Red2
6BSA Champ 20" Sea. Foam Green8
7BSA Champ 20" V.Blue6
8BSA Champ Orbit 20" Cel. Blue12
9BSA Champ Orbit 20" Red6
10BSA Daisy 14" Sky Blue2
11BSA Ladybird Diana 24" Doodle Pink8
12BSA Doodle 20" Victor Blue4
13BSA Go 20" Matt. Black Neon Orange2
14BSA Go Biking 14" Victor Blue Grey2
15BSA Go Biking 16" Ferrari Red & Led Grey2
16BSA Ladybird Hazel 24" Sports Purple10
17BSA Ladybird Hazel 24" Pearl Pink12
18BSA Kinder 14" Blue2
19BSA Kinder 14" Red2
20BSA Kinder 16" Red2
21BSA Kinder 16" Sunflower Yellow6
22BSA Kinder 16" Victor Blue4
23BSA Kinder 20" Doodle Pink4
24BSA Kinder 20" Lawn Green2
25BSA Kinder 20" S.Red2
26BSA Kinder 20" Sunflower Yellow 6
27BSA Kinder 20" Victor Blue6
28BSA Ladybird Diana 26" Doodle Pink22
29BSA Ladybird Diana 26" Sea Foam Green4
30BSA Ladybird Diva 26" Clestial Blue6
31BSA Ladybird Diva 26" Sports Purple2
32BSA Ladybird Hazel 26" Artic .Blue2
33BSA Ladybird Hazel 26" Pearl Pin k4
34BSA Ladybird Hazel 26" Sports Purple6
35BSA Ladybird Shine 26" Citron Green8
36BSA Ladybird Shine 26" Clestial Blue12
37BSA Ladybird Shine 26" Pearl Pink2
38BSA Ladybird Sofia 26" Aqua Marine Blue M.Pink6
39BSA Ladybird Sofia 26" Larosa Pink Macron Pink2
40BSA Ladybird Summer 26" Pink4
41BSA Roamer 12" Red 2
42BSA Roamer 16" Citron Green2
43BSA Roamer 16" Metalic Blue2
44BSA Roamer 16" Metalic Red4
45BSA Roamer 20" Green4
46BSA Roamer 20" Red16
47BSA Shine 24" Pink20
48BSA Toonz 16" Pink2
49BSA Trooper 20" Green Golden Yellow2
50Cosmic Comet 26" Black Orange1
51Cosmic Comet 26" Blue Yellow1
52Cosmic Comet 29" Black Blue1
53Cosmic Fern 24" Pink1
54Cosmic Jade 16" Pink1
55Cosmic Jade 16" Violet2
56Cosmic Jolt 29" Yellow Blue1
57Cosmic Level 9160 27.5 Silver Red1
58Hercules Streetcat Pro 24" Matt. Black Red6
59Hercules Wildrock IC RF 26" Black Red2
60Hercules Photon Speed Star 26" Matt. Black 2
61Hercules A-220 HT DX2 29" SS Matt. Balck Twitter Blue4
62Hercules A-220 HT DX2 27.5" Matt. Black Frame Orange3
63Hercules Atom ZX - 26" Black Orange2
64Hercules Brut 2.0 ZX - 26" Matt. Black A. Green2
65Hercules Captain EX - Gents RB2
66Hercules Captain EX - Ladies RB2
67Hercules FX - 200 IC 26" Victor Blue Matt. Black2
68Hercules Kombat R/F 24" Black4
69Hercules Kombat RF - 26" Black4
70Hercules Kombat RF - 26" Red4
71Hercules Kombat ZX - 26" Matt. Balack A.Green4
72Hercules Sparx 2.0 RF 24" Black6
73Hercules Sparx 2.0 RF 26" Victor Blue4
74Hercules Standard Green16
75Hercules Street Rider R/F 26" Black2
76Hercules Street Rider RF 24" Black2
77Hercules Street Rider RF 24" S.Red6
78Hercules Street Rider RF 26" Victor Blue8
79Hercules Streetcat IC HT DX2 26" Matt Black6
80Hercules Streetcat Pro 24" IC - Victor Blue6
81Hercules Streetcat Pro 26" Acid Green2
82Hercules Streetcat Pro 26" Tropper Grey2
83Hercules Streetcat Pro HT DX2 26" Black A.Green4
84Hercules Streetcat Pro IC 24" A.Green2
85Hercules Streetcat Pro R/F 24" (DB - Rim) Black Green4
86Hercules Streetrider R/F 24" Smart Red4
87Hercules Streetrider ZX 24" Smart Red Black2
88Hercules Streetrider ZX 26" Black A.Green6
89Hercules Trailfire HT 26" Ivory White6
90Hercules Trailfire HT 26" Matt. Black N.Green4
91Hercules Trailfire R/F DX2 26" Magic Blue F.Orange8
92Hercules Tussle 26" RF Black4
93Hercules Tussle 26" RF Red2
94Hercules Wayfinder IC HT DX2 26" Matt. Black2
95Hercules Wildrock IC HT 26" Glossy Black Twitter Blue2
96Hercules Wildrock IC R/F 26" Glossy Black 4
97Hercules Wildrock R/F 24" Black Twitter Blue4
98Hercules Wildrock R/F 26" Glossy Black 2
99Hero Jackoo 12" Red8
100Hero Blaze 16" Purple6
101Hero Blaze 16" Red2
102Hero Blaze 16" Yellow2
103Hero Bobcat 16" Black2
104Hero Bobcat 20" Red2
105Hero Boomer 16 Orange4
106Hero Boomer 16 Pink4
107Hero Boomer 16" Green2
108Hero Boomer 20" Orange2
109Hero Boomer 20" Pink2
110Hero Colt 26" Black2
111Hero Colt 26" Sky Blue2
112Hero Jackoo 1420
113Hero Jet Green Standard4
114Hero Miss India Velvet 26" Pink2
115Hero Rafale 26" Black4
116Hero Ride On 16" Green2
117Hero Ride On 16" Red4
118Hero Ride On 20" Green2
119Hero Ride On 20" Red4
120Hero Rock Star 16" Pink2
121Hero Rock Star 20" Red2
122Hero Rockstar 12" Green2
123Hero Rockstar 12" Pink4
124Hero Rockstar 12" Red2
125Hero Sting 16" IC Black4
126Hero Sting IC 20" Red2
127Hero Sundance 20" Red2
128Hero Sundancer 16" Pink4
129Hero Sundancer 20" Pink6
130Hero Urban Trail 26" SS Black2
131Hero Urban Trail 26" SS Blue2
132Hero Urban Trail 26" SS Red4
133Hero Whistle 16" Black2
134Hero Whistle 16" Red2
135Hero Whistle 16" Sky Blue2
136Hero Whistle 20" Black6
137Hero Whistle 20" Sky Blue2
138Hero Winner 16" Black2
139Hero Winner 16" Red 2
140Hercules FX - 100 DX2 3.0 26" SS Matt Black N.Orange7
141Machcity Munich 700 x 35 C SS Med. Pac. Blue5
142Machcity 26" S/S Med Forest Green17
143Machcity Munich 700 X 35 C 21 SP Med. Pac. Blue1
144Machcity S/S 26" Medium Victor Blue25
145Montra Downtown 700 C Med. Neon Yellow Black2
146Montra DTR 20" 6 SP Lava Red with Black2
147Montra DTR 20" 6 SP Red with Black Graphics1
148Ninety One Bombay 26" M.S DD Black Red2
149Ninety One Bombay 26" M.S DD Green2
150Ninety One Bombay 26" M.S DD Grey1
151Ninety One Drago 29" S/S DD Black Grey 1
152Ninety One Skull Rider 26" SS Dual Disk - Black Yellow1
153Ninety One Tokyo 26" M.S DD Black Red1
154Old Stock - Hero BMX Rotter 20" 2
155Old Stock - Hero RX2 26" 9
156Old Stock - BSA BAZooka 26"10
157Old Stock - BSA Reflex 26" 18
158Old Stock - Hercules Atom 26" Green6
159Raleigh Green Gents Standard 22 Gents6
160Riyoko Elite 24"4
161Riyoko Elite 26" 6
162Riyoko Nicky 24" 8
163Roadeo A-75 26" 21 SP D/D Black Neon Red1
164Roadeo A-75 26" 21 SP D/D Lapis Blue Neon Yellow4
165Roadeo Fugitive 27.5 21 SP DD Antiq Blue1
166Roadeo Fugitive 29" 21 SP DD Matt Black2
167Roadeo NFS 27.5" 21 SP D/D Black Neon Red1
168Roadeo NFS 27.5" 21 SP D/D Black Neon Yellow2
169Roadeo NFS 29" 21 SP D/D Black Neon Green2
170Rockstar 14" Red2
171Space Varder 16" Orange Ivory White4
172Space Varder 16" S.Purple4
173Space Varder 20" Sports Purple Hot pink4
174Space Varder 20"Smart Red8
175Top Trak Bull 20" Green2
176Top Trak Bull 20" Orange6
177Top Trak Challenger 2014
178Top Trak Floris 24" Blue2
179Top Trak Floris 26" Blue2
180Top Trak Floris 26" Pink4
181Top Trak Floris 26" Purple6
182Top Trak Fly Lady 24" Pink6
183Top Trak Fly Lady 24" Purple 2
184Top Trak Kelly 16" 10
185Top Trak Kelly 20" 8
186Top Trak Krooz 20" Blue6
187Top Trak Spike Pro 20" Green4
188Top Trak Spike Pro 20" Orange2
1897/27/2023BSA Ladybird Hazel 24" Sports Purple2
1907/27/2023Hercules Sparx 2.0 RF 24" Black4
1917/27/2023Hercules Streetcat Pro R/F 24" (DB - Rim) Black Green2
1927/27/2023Hercules Tussle 26" RF Red2
1937/27/2023Hercules Trailfire R/F DX2 26" Magic Blue F.Orange2
1947/27/2023Hercules Wildrock IC R/F 26" Glossy Black 2
1957/27/2023Hero Colt 26" Black Red1
1967/27/2023Hero Colt 26" Black Blue1
1977/27/2023Hercules Streetcat Pro IC DX2 24" Black A.Green2
1987/27/2023Hercules Streetcat Pro HT DX2 26" Black A.Green2
1997/27/2023BSA Ladybird Diana 26" Sea Foam Green2
2007/27/2023Hercules Streetcat Pro HT DX2 26" Black A.Green2
2017/27/2023Hercules Streetrider ZX 26" Black A.Green2
2027/27/2023Cosmic Level Tigo 29" SS ST FS Red1
2037/27/2023Cosmic Jolt 29" Yellow Blue1
2047/27/2023Ninety One Drago 27.5" S/S DD Black Red1
2057/27/2023Ninety One Skull Rider 26" SS Dual Disk - Black Red1
2067/27/2023BSA Ladybird Hazel 26" Sports Purple2
2077/27/2023Hercules Trailfire HT 26" Matt. Black N.Green2
2087/27/2023Hercules Kombat RF - 26" Black2
2097/27/2023Hercules Standard Black2
2107/27/2023Hercules Streetcat Pro 24" Matt. Black Red1
2117/27/2023Cosmic Comet 26" SS Silver Red1
2127/27/2023Hercules Street Rider RF 26" Victor Blue1
2137/27/2023Cosmic Maze 27.5" SS ST FS1
2147/27/2023Cosmic Maze 29" SS ST FS2
2157/27/2023BSA Ladybird Diva 26" Sports Purple2
2167/27/2023BSA Ladybird Summer 26" Victor Blue2
2177/27/2023Cosmic Comet 29" SS ST FS Grey2
2187/27/2023Hercules FX - 100 DX2 3.0 26" SS Matt Black N.Orange1
2197/27/2023Cosmic Hulk 29" SS ST FS Silver Red1
2207/27/2023BSA Champ Orbit 20" Cel. Blue3
2217/27/2023Top Trak Challenger 201
2227/27/2023Ninety One Tokyo 27.5" SS DD Grey Yellow2
2237/27/2023BSA Agent X 20" Blue Pink2
2247/27/2023BSA Go Biking 20" 2
2257/27/2023BSA Ladybird Hazel 26" Sports Purple2
2267/27/2023Ninety One Alpha Serenity 26" Black / Pink2
2277/27/2023Ninety One Tokyo 27.5" SS DD Black Red2
2288/2/2023BSA Ladybird Hazel 26" Pearl Pin k12
2298/2/2023BSA Ladybird Hazel 26" Black20
2308/2/2023BSA Ladybird Splash 26" B.Pink Pearl White4
2318/2/2023BSA Ladybird Sofia 26" Pearl Pink8
2328/2/2023Montra Unplugged FX SS 27.5 G Neon Green1
2338/4/2023BSA Ladybird Summer 26" Victor Blue20
234BSA Ladybird Shine 26" Pearl Pink8
235BSA Ladybird Hazel 26" Sports Purple8
236Hercules Sparx 2.0 RF 24" Black6
237Hercules Tussle 26" RF Red8
238Hercules Sparx 2.0 RF 26" Victor Blue4
239BSA Ladybird Diana 24" Sea foam Green6
240BSA Trooper 20" Green Golden Yellow2
241BSA Wildcat 20" Cyan Green2
242BSA Platoon FX-20 " Trooper Grey2
243BSA Ladybird Valerie 26" Scarlet Red1
244Hercules Streetcat Pro 26" Tropper Grey8
245BSA Kinder 14 Ruby Pink2
246BSA Kinder 12" Victor Blue2
247BSA Roamer 12" Citron Green6
248BSA Champ 14" Seafoam Green4
249BSA Champ 12" Seafoam Green4
250Hercules Wildrock IC RF 26" Black Red2
251Hercules Bazooka 2.0 IC 26" Black Blue Yellow8
252Hercules Wildrock 26" HT Black Red8
253BSA Go Biking 14" Red and Grey4
254BSA Ladybird Diva 26" Sports Purple10
255Hercules Wildrock IC RF 24" Black Red2
256BSA Ladybird Diva 26" Doodle Pink10
2578/10/2023BSA Ladybird Summer 26" Pink10
258Hercules Street Rider ZX 26 " Black Neon Red10
259Hercules Dynamite ZX 24" Black Acid Green4
260Hercules Trailfire R/F 26" Ivory White2
261Hercules Kombat R/F 24" Black6
262Hercules Standard Green12
263BSA Ladybird Valencia 26" Ballet Pink2
264BSA Platoon SS 20" Trooper Grey with Blue2
265Hercules Streetcat Pro IC RF 26" Black 8
266Hercules Streetcat Pro HT IC DX2 26" Black A.Green8
267Hercules Wildrock IC RF 26" Black Red6
268BSA Ladybird Cindy 26" Blue Berry Blue2
269Hercules Wildrock IC RF 24" Black Twitter Blue2
270Hercules Bazooka 2.0 RF 24" Black Rubine Red2
271Top Track Ride 20"12
272Hercules Standard Black12
273Hercules Sparx 2.0 R/F 26" Black8
274BSA Champ 14" Victor Blue 2
275BSA Ladybird Cindy 26" Doodle Pink2
Sheet1


Sheet2 Data:
Compare between 2 Sheets.xlsm
AB
1BSA Agent X 20" Blue Pink4
2BSA Champ 16" Green2
3BSA Champ 16" Red4
4BSA Champ 16" Victor Blue2
5BSA Champ 20" Red2
6BSA Champ 20" Sea. Foam Green8
7BSA Champ 20" V.Blue6
8BSA Champ Orbit 20" Cel. Blue12
9BSA Champ Orbit 20" Red6
10BSA Daisy 14" Sky Blue2
11BSA Diana 24" Doodle Pink8
12BSA Doodle 20" Victor Blue4
13BSA Go 20" Matt. Black Neon Orange2
14BSA Go Biking 14" Victor Blue Grey2
15BSA Go Biking 16" Ferrari Red & Led Grey2
16BSA Hazel 24" Sports Purple12
17BSA Hazel 24" Pearl Pink12
18BSA Kinder 14" Blue2
19BSA Kinder 14" Red2
20BSA Kinder 16" Red2
21BSA Kinder 16" Sunflower Yellow6
22BSA Kinder 16" Victor Blue4
23BSA Kinder 20" Doodle Pink4
24BSA Kinder 20" Lawn Green2
25BSA Kinder 20" S.Red2
26BSA Kinder 20" Sunflower Yellow 6
27BSA Kinder 20" Victor Blue6
28BSA Ladybird Diana 26" Doodle Pink22
29BSA Ladybird Diana 26" Sea Foam Green4
30BSA Ladybird Diva 26" Clestial Blue6
31BSA Ladybird Diva 26" Sports Purple2
32BSA Ladybird Hazel 26" Artic .Blue2
33BSA Ladybird Hazel 26" Pearl Pin k4
34BSA Ladybird Hazel 26" Sports Purple6
35BSA Ladybird Shine 26" Citron Green8
36BSA Ladybird Shine 26" Clestial Blue12
37BSA Ladybird Shine 26" Pearl Pink2
38BSA Ladybird Sofia 26" Aqua Marine Blue M.Pink6
39BSA Ladybird Sofia 26" Larosa Pink Macron Pink2
40BSA Ladybird Summer 26" Pink4
41BSA Roamer 12" Red 2
42BSA Roamer 16" Citron Green2
43BSA Roamer 16" Metalic Blue2
44BSA Roamer 16" Metalic Red4
45BSA Roamer 20" Green4
46BSA Roamer 20" Red16
47BSA Shine 24" Pink20
48BSA Toonz 16" Pink2
49BSA Trooper 20" Green Golden Yellow2
50Cosmic Comet 26" Black Orange1
51Cosmic Comet 26" Blue Yellow1
52Cosmic Comet 29" Black Blue1
53Cosmic Fern 24" Pink1
54Cosmic Jade 16" Pink1
55Cosmic Jade 16" Violet2
56Cosmic Jolt 29" Yellow Blue1
57Cosmic Level 9160 27.5 Silver Red1
58Hecules Streetcat Pro 24" Matt. Black Red6
59Hecules Wildrock IC RF 26" Black Red2
60Hercule Photon Speed Star 26" Matt. Black 2
61Hercules A-220 HT DX2 29" SS Matt. Balck Twitter Blue4
62Hercules A-220 HT DX2 27.5" Matt. Black Frame Orange3
63Hercules Atom ZX - 26" Black Orange2
64Hercules Brut 2.0 ZX - 26" Matt. Black A. Green2
65Hercules Captain EX - Gents RB2
66Hercules Captain EX - Ladies RB2
67Hercules FX - 200 IC 26" Victor Blue Matt. Black2
68Hercules Kombat R/F 24" Black4
69Hercules Kombat RF - 26" Black4
70Hercules Kombat RF - 26" Red4
71Hercules Kombat ZX - 26" Matt. Balack A.Green4
72Hercules Sparx 2.0 RF 24" Black6
73Hercules Sparx 2.0 RF 26" Victor Blue4
74Hercules Standard Green16
75Hercules Street Rider R/F 26" Black2
76Hercules Street Rider RF 24" Black2
77Hercules Street Rider RF 24" S.Red6
78Hercules Street Rider RF 26" Victor Blue8
79Hercules Streetcat IC HT DX2 26" Matt Black6
80Hercules Streetcat Pro 24" IC - Victor Blue6
81Hercules Streetcat Pro 26" Acid Green2
82Hercules Streetcat Pro 26" Tropper Grey2
83Hercules Streetcat Pro HT DX2 26" Black A.Green4
84Hercules Streetcat Pro IC 24" A.Green2
85Hercules Streetcat Pro R/F 24" (DB - Rim) Black Green4
86Hercules Streetrider R/F 24" Smart Red4
87Hercules Streetrider ZX 24" Smart Red Black2
88Hercules Streetrider ZX 26" Black A.Green6
89Hercules Trailfire HT 26" Ivory White6
90Hercules Trailfire HT 26" Matt. Black N.Green4
91Hercules Trailfire R/F DX2 26" Magic Blue F.Orange8
92Hercules Tussle 26" RF Black4
93Hercules Tussle 26" RF Red2
94Hercules Wayfinder IC HT DX2 26" Matt. Black2
95Hercules Wildrock IC HT 26" Glossy Black Twitter Blue2
96Hercules Wildrock IC R/F 26" Glossy Black 4
97Hercules Wildrock R/F 24" Black Twitter Blue4
98Hercules Wildrock R/F 26" Glossy Black 2
99Hero Jackoo 12" Red8
100Hero Blaze 16" Purple6
101Hero Blaze 16" Red2
102Hero Blaze 16" Yellow2
103Hero Bobcat 16" Black2
104Hero Bobcat 20" Red2
105Hero Boomer 16 Orange4
106Hero Boomer 16 Pink4
107Hero Boomer 16" Green2
108Hero Boomer 20" Orange2
109Hero Boomer 20" Pink2
110Hero Colt 26" Black2
111Hero Colt 26" Sky Blue2
112Hero Jackoo 1420
113Hero Jet Green Standard4
114Hero Miss India Velvet 26" Pink2
115Hero Rafale 26" Black4
116Hero Ride On 16" Green2
117Hero Ride On 16" Red4
118Hero Ride On 20" Green2
119Hero Ride On 20" Red4
120Hero Rock Star 16" Pink2
121Hero Rock Star 20" Red2
122Hero Rockstar 12" Green2
123Hero Rockstar 12" Pink4
124Hero Rockstar 12" Red2
125Hero Sting 16" IC Black4
126Hero Sting IC 20" Red2
127Hero Sundance 20" Red2
128Hero Sundancer 16" Pink4
129Hero Sundancer 20" Pink6
130Hero Urban Trail 26" SS Black2
131Hero Urban Trail 26" SS Blue2
132Hero Urban Trail 26" SS Red4
133Hero Whistle 16" Black2
134Hero Whistle 16" Red2
135Hero Whistle 16" Sky Blue2
136Hero Whistle 20" Black6
137Hero Whistle 20" Sky Blue2
138Hero Winner 16" Black2
139Hero Winner 16" Red 2
140Herules FX - 100 DX2 3.0 26" SS Matt Black N.Orange7
141Machcit Munich 700 x 35 C SS Med. Pac. Blue5
142Machcity 26" S/S Med Forest Green17
143Machcity Munich 700 X 35 C 21 SP Med. Pac. Blue1
144Machcity S/S 26" Medium Victor Blue25
145Montra Downtown 700 C Med. Neon Yellow Black2
146Montra DTR 20" 6 SP Lava Red with Black2
147Montra DTR 20" 6 SP Red with Black Graphics1
148Ninety One Bombay 26" M.S DD Black Red2
149Ninety One Bombay 26" M.S DD Green2
150Ninety One Bombay 26" M.S DD Grey1
151Ninety One Drago 29" S/S DD Black Grey 1
152Ninety One Skull Rider 26" SS Dual Disk - Black Yellow1
153Ninety One Tokyo 26" M.S DD Black Red1
154Old Stock - Hero BMX Rotter 20" 2
155Old Stock - Hero RX2 26" 9
156Old Stock - BSA BAZooka 26"10
157Old Stock - BSA Reflex 26" 18
158Old Stock - Hercules Atom 26" Green6
159Raleigh Green Gents Standard 22 Gents6
160Riyoko Elite 24"4
161Riyoko Elite 26" 6
162Riyoko Nicky 24" 8
163Roadeo A-75 26" 21 SP D/D Black Neon Red1
164Roadeo A-75 26" 21 SP D/D Lapis Blue Neon Yellow4
165Roadeo Fugitive 27.5 21 SP DD Antiq Blue1
166Roadeo Fugitive 29" 21 SP DD Matt Black2
167Roadeo NFS 27.5" 21 SP D/D Black Neon Red1
168Roadeo NFS 27.5" 21 SP D/D Black Neon Yellow2
169Roadeo NFS 29" 21 SP D/D Black Neon Green2
170Rockstar 14" Red2
171Space Varder 16" Orange Ivory White4
172Space Varder 16" S.Purple4
173Space Varder 20" Sports Purple Hot pink4
174Space Varder 20"Smart Red8
175Top Trak Bull 20" Green2
176Top Trak Bull 20" Orange6
177Top Trak Challenger 2014
178Top Trak Floris 24" Blue2
179Top Trak Floris 26" Blue2
180Top Trak Floris 26" Pink4
181Top Trak Floris 26" Purple6
182Top Trak Fly Lady 24" Pink6
183Top Trak Fly Lady 24" Purple 2
184Top Trak Kelly 16" 10
185Top Trak Kelly 20" 8
186Top Trak Krooz 20" Blue6
187Top Trak Spike Pro 20" Green4
188Top Trak Spike Pro 20" Orange2
189Top Track Ride 20"12
Sheet2


Expected Output:
Compare between 2 Sheets.xlsm
ABCDEFGHI
1Missing Values in Sheet2Duplicate Values in Sheet1Duplicate Values2
2DateItemQuantityDateItemQuantityDateItemQuantity
3BSA Ladybird Diana 24" Doodle PinkBSA Diana 24" Doodle PinkBSA Agent X 20" Blue Pink
4BSA Ladybird Hazel 24" Sports PurpleBSA Hazel 24" Sports PurpleBSA Champ 16" Green
5BSA Ladybird Hazel 24" Pearl PinkBSA Hazel 24" Pearl PinkBSA Champ 16" Red
6Hercules Streetcat Pro 24" Matt. Black RedHecules Streetcat Pro 24" Matt. Black RedBSA Champ 16" Victor Blue
7Hercules Wildrock IC RF 26" Black RedHecules Wildrock IC RF 26" Black RedBSA Champ 20" Red
8Hercules Photon Speed Star 26" Matt. Black Hercule Photon Speed Star 26" Matt. Black BSA Champ 20" Sea. Foam Green
9Hercules FX - 100 DX2 3.0 26" SS Matt Black N.OrangeHerules FX - 100 DX2 3.0 26" SS Matt Black N.OrangeBSA Champ 20" V.Blue
10Machcity Munich 700 x 35 C SS Med. Pac. BlueMachcit Munich 700 x 35 C SS Med. Pac. BlueBSA Champ Orbit 20" Cel. Blue
11Hero Colt 26" Black RedBSA Champ Orbit 20" Red
12Hero Colt 26" Black BlueBSA Daisy 14" Sky Blue
13Hercules Streetcat Pro IC DX2 24" Black A.GreenBSA Doodle 20" Victor Blue
14Cosmic Level Tigo 29" SS ST FS RedBSA Go 20" Matt. Black Neon Orange
15Ninety One Drago 27.5" S/S DD Black RedBSA Go Biking 14" Victor Blue Grey
16Ninety One Skull Rider 26" SS Dual Disk - Black RedBSA Go Biking 16" Ferrari Red & Led Grey
17Hercules Standard BlackBSA Kinder 14" Blue
18Cosmic Comet 26" SS Silver RedBSA Kinder 14" Red
19Cosmic Maze 27.5" SS ST FSBSA Kinder 16" Red
20Cosmic Maze 29" SS ST FSBSA Kinder 16" Sunflower Yellow
21BSA Ladybird Summer 26" Victor BlueBSA Kinder 16" Victor Blue
22Cosmic Comet 29" SS ST FS GreyBSA Kinder 20" Doodle Pink
23Cosmic Hulk 29" SS ST FS Silver RedBSA Kinder 20" Lawn Green
24Ninety One Tokyo 27.5" SS DD Grey YellowBSA Kinder 20" S.Red
25BSA Go Biking 20" BSA Kinder 20" Sunflower Yellow
26Ninety One Alpha Serenity 26" Black / PinkBSA Kinder 20" Victor Blue
27Ninety One Tokyo 27.5" SS DD Black RedBSA Ladybird Diana 26" Doodle Pink
28BSA Ladybird Hazel 26" BlackBSA Ladybird Diana 26" Sea Foam Green
29BSA Ladybird Splash 26" B.Pink Pearl WhiteBSA Ladybird Diva 26" Clestial Blue
30BSA Ladybird Sofia 26" Pearl PinkBSA Ladybird Diva 26" Sports Purple
31Montra Unplugged FX SS 27.5 G Neon GreenBSA Ladybird Hazel 26" Artic .Blue
32BSA Ladybird Diana 24" Sea foam GreenBSA Ladybird Hazel 26" Pearl Pin k
33BSA Wildcat 20" Cyan GreenBSA Ladybird Hazel 26" Sports Purple
34BSA Platoon FX-20 " Trooper GreyBSA Ladybird Shine 26" Citron Green
35BSA Ladybird Valerie 26" Scarlet RedBSA Ladybird Shine 26" Clestial Blue
36BSA Kinder 14 Ruby PinkBSA Ladybird Shine 26" Pearl Pink
37BSA Kinder 12" Victor BlueBSA Ladybird Sofia 26" Aqua Marine Blue M.Pink
38BSA Roamer 12" Citron GreenBSA Ladybird Sofia 26" Larosa Pink Macron Pink
39BSA Champ 14" Seafoam GreenBSA Ladybird Summer 26" Pink
40BSA Champ 12" Seafoam GreenBSA Roamer 12" Red
41Hercules Bazooka 2.0 IC 26" Black Blue YellowBSA Roamer 16" Citron Green
42Hercules Wildrock 26" HT Black RedBSA Roamer 16" Metalic Blue
43BSA Go Biking 14" Red and GreyBSA Roamer 16" Metalic Red
44Hercules Wildrock IC RF 24" Black RedBSA Roamer 20" Green
45BSA Ladybird Diva 26" Doodle PinkBSA Roamer 20" Red
46Hercules Street Rider ZX 26 " Black Neon RedBSA Shine 24" Pink
47Hercules Dynamite ZX 24" Black Acid GreenBSA Toonz 16" Pink
48Hercules Trailfire R/F 26" Ivory WhiteBSA Trooper 20" Green Golden Yellow
49BSA Ladybird Valencia 26" Ballet PinkCosmic Comet 26" Black Orange
50BSA Platoon SS 20" Trooper Grey with BlueCosmic Comet 26" Blue Yellow
51Hercules Streetcat Pro IC RF 26" Black Cosmic Comet 29" Black Blue
52Hercules Streetcat Pro HT IC DX2 26" Black A.GreenCosmic Fern 24" Pink
53BSA Ladybird Cindy 26" Blue Berry BlueCosmic Jade 16" Pink
54Hercules Wildrock IC RF 24" Black Twitter BlueCosmic Jade 16" Violet
55Hercules Bazooka 2.0 RF 24" Black Rubine RedCosmic Jolt 29" Yellow Blue
56Hercules Sparx 2.0 R/F 26" BlackCosmic Level 9160 27.5 Silver Red
57BSA Champ 14" Victor Blue Hercules A-220 HT DX2 29" SS Matt. Balck Twitter Blue
58BSA Ladybird Cindy 26" Doodle PinkHercules A-220 HT DX2 27.5" Matt. Black Frame Orange
59Hercules Atom ZX - 26" Black Orange
60Hercules Brut 2.0 ZX - 26" Matt. Black A. Green
61Hercules Captain EX - Gents RB
62Hercules Captain EX - Ladies RB
63Hercules FX - 200 IC 26" Victor Blue Matt. Black
64Hercules Kombat R/F 24" Black
65Hercules Kombat RF - 26" Black
66Hercules Kombat RF - 26" Red
67Hercules Kombat ZX - 26" Matt. Balack A.Green
68Hercules Sparx 2.0 RF 24" Black
69Hercules Sparx 2.0 RF 26" Victor Blue
70Hercules Standard Green
71Hercules Street Rider R/F 26" Black
72Hercules Street Rider RF 24" Black
73Hercules Street Rider RF 24" S.Red
74Hercules Street Rider RF 26" Victor Blue
75Hercules Streetcat IC HT DX2 26" Matt Black
76Hercules Streetcat Pro 24" IC - Victor Blue
77Hercules Streetcat Pro 26" Acid Green
78Hercules Streetcat Pro 26" Tropper Grey
79Hercules Streetcat Pro HT DX2 26" Black A.Green
80Hercules Streetcat Pro IC 24" A.Green
81Hercules Streetcat Pro R/F 24" (DB - Rim) Black Green
82Hercules Streetrider R/F 24" Smart Red
83Hercules Streetrider ZX 24" Smart Red Black
84Hercules Streetrider ZX 26" Black A.Green
85Hercules Trailfire HT 26" Ivory White
86Hercules Trailfire HT 26" Matt. Black N.Green
87Hercules Trailfire R/F DX2 26" Magic Blue F.Orange
88Hercules Tussle 26" RF Black
89Hercules Tussle 26" RF Red
90Hercules Wayfinder IC HT DX2 26" Matt. Black
91Hercules Wildrock IC HT 26" Glossy Black Twitter Blue
92Hercules Wildrock IC R/F 26" Glossy Black
93Hercules Wildrock R/F 24" Black Twitter Blue
94Hercules Wildrock R/F 26" Glossy Black
95Hero Jackoo 12" Red
96Hero Blaze 16" Purple
97Hero Blaze 16" Red
98Hero Blaze 16" Yellow
99Hero Bobcat 16" Black
100Hero Bobcat 20" Red
101Hero Boomer 16 Orange
102Hero Boomer 16 Pink
103Hero Boomer 16" Green
104Hero Boomer 20" Orange
105Hero Boomer 20" Pink
106Hero Colt 26" Black
107Hero Colt 26" Sky Blue
108Hero Jackoo 14
109Hero Jet Green Standard
110Hero Miss India Velvet 26" Pink
111Hero Rafale 26" Black
112Hero Ride On 16" Green
113Hero Ride On 16" Red
114Hero Ride On 20" Green
115Hero Ride On 20" Red
116Hero Rock Star 16" Pink
117Hero Rock Star 20" Red
118Hero Rockstar 12" Green
119Hero Rockstar 12" Pink
120Hero Rockstar 12" Red
121Hero Sting 16" IC Black
122Hero Sting IC 20" Red
123Hero Sundance 20" Red
124Hero Sundancer 16" Pink
125Hero Sundancer 20" Pink
126Hero Urban Trail 26" SS Black
127Hero Urban Trail 26" SS Blue
128Hero Urban Trail 26" SS Red
129Hero Whistle 16" Black
130Hero Whistle 16" Red
131Hero Whistle 16" Sky Blue
132Hero Whistle 20" Black
133Hero Whistle 20" Sky Blue
134Hero Winner 16" Black
135Hero Winner 16" Red
136Machcity 26" S/S Med Forest Green
137Machcity Munich 700 X 35 C 21 SP Med. Pac. Blue
138Machcity S/S 26" Medium Victor Blue
139Montra Downtown 700 C Med. Neon Yellow Black
140Montra DTR 20" 6 SP Lava Red with Black
141Montra DTR 20" 6 SP Red with Black Graphics
142Ninety One Bombay 26" M.S DD Black Red
143Ninety One Bombay 26" M.S DD Green
144Ninety One Bombay 26" M.S DD Grey
145Ninety One Drago 29" S/S DD Black Grey
146Ninety One Skull Rider 26" SS Dual Disk - Black Yellow
147Ninety One Tokyo 26" M.S DD Black Red
148Old Stock - Hero BMX Rotter 20"
149Old Stock - Hero RX2 26"
150Old Stock - BSA BAZooka 26"
151Old Stock - BSA Reflex 26"
152Old Stock - Hercules Atom 26" Green
153Raleigh Green Gents Standard 22 Gents
154Riyoko Elite 24"
155Riyoko Elite 26"
156Riyoko Nicky 24"
157Roadeo A-75 26" 21 SP D/D Black Neon Red
158Roadeo A-75 26" 21 SP D/D Lapis Blue Neon Yellow
159Roadeo Fugitive 27.5 21 SP DD Antiq Blue
160Roadeo Fugitive 29" 21 SP DD Matt Black
161Roadeo NFS 27.5" 21 SP D/D Black Neon Red
162Roadeo NFS 27.5" 21 SP D/D Black Neon Yellow
163Roadeo NFS 29" 21 SP D/D Black Neon Green
164Rockstar 14" Red
165Space Varder 16" Orange Ivory White
166Space Varder 16" S.Purple
167Space Varder 20" Sports Purple Hot pink
168Space Varder 20"Smart Red
169Top Trak Bull 20" Green
170Top Trak Bull 20" Orange
171Top Trak Challenger 20
172Top Trak Floris 24" Blue
173Top Trak Floris 26" Blue
174Top Trak Floris 26" Pink
175Top Trak Floris 26" Purple
176Top Trak Fly Lady 24" Pink
177Top Trak Fly Lady 24" Purple
178Top Trak Kelly 16"
179Top Trak Kelly 20"
180Top Trak Krooz 20" Blue
181Top Trak Spike Pro 20" Green
182Top Trak Spike Pro 20" Orange
183Top Track Ride 20"
Expected Result
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
There's a number of ways you could do this (e.g. scripting dictionaries) but seeing as you have 365 - why not take advantage of the available functions? Here's a method that puts formulas on the Expected Results sheet, then converts to values. Change the sheet names to suit, and please try it on a copy of your workbook first. The result I get varies from what you posted above, but I'm a little unclear as to what you mean by duplicate values - I'm assuming you meant list values from each of sheets 1 & 2 that were duplicates on their respective sheets? If that's the case, then the result I got is correct when I checked the respective sheets for duplicates.

VBA Code:
Option Explicit
Sub Compare_With_Formulas()
    Dim ws1 As Worksheet, ws2 As Worksheet, ws3 As Worksheet
    Set ws1 = Worksheets("Sheet1")          '<-- *** Change sheet names to suit ***
    Set ws2 = Worksheets("Sheet2")
    Set ws3 = Worksheets("Expected Result")
    
    With ws3
        .Range("B3", ws3.Cells(Rows.Count, "B").End(xlUp)).ClearContents
        .Range("E3", ws3.Cells(Rows.Count, "E").End(xlUp)).ClearContents
        .Range("H3", ws3.Cells(Rows.Count, "H").End(xlUp)).ClearContents
    End With
    
    Dim LRow1 As Long, LRow2 As Long
    LRow1 = ws1.Cells(Rows.Count, "B").End(xlUp).Row
    LRow2 = ws2.Cells(Rows.Count, "A").End(xlUp).Row
    
    ws3.Range("B3").Formula2 = "=IFERROR(FILTER(Sheet2!A1:A" & LRow2 & ",COUNTIF(Sheet1!B2:B" & LRow1 & ",Sheet2!A1:A" & LRow2 & ")=0),""no missing values found"")"
    ws3.Range("E3").Formula2 = "=IFERROR(UNIQUE(FILTER(Sheet1!B2:B" & LRow1 & ",COUNTIF(Sheet1!B2:B" & LRow1 & ",Sheet1!B2:B" & LRow1 & ")>1)),""no duplicates found"")"
    ws3.Range("H3").Formula2 = "=IFERROR(UNIQUE(FILTER(Sheet2!A1:A" & LRow2 & ",COUNTIF(Sheet2!A1:A" & LRow2 & ",Sheet2!A1:A" & LRow2 & ")>1)),""no duplicates found"")"
    With ws3.Range("B3#")
        .Value2 = .Value2
    End With
    With ws3.Range("E3#")
        .Value2 = .Value2
    End With
    With ws3.Range("H3#")
        .Value2 = .Value2
    End With
End Sub
 
Upvote 0
There's a number of ways you could do this (e.g. scripting dictionaries) but seeing as you have 365 - why not take advantage of the available functions? Here's a method that puts formulas on the Expected Results sheet, then converts to values. Change the sheet names to suit, and please try it on a copy of your workbook first. The result I get varies from what you posted above, but I'm a little unclear as to what you mean by duplicate values - I'm assuming you meant list values from each of sheets 1 & 2 that were duplicates on their respective sheets? If that's the case, then the result I got is correct when I checked the respective sheets for duplicates.
Hello Kevin,

That is an interesting way to do this. And, it works. Thank you very much!

However, I need a code that will work in other versions too in this case. I see you have used the FILTER function that is used only in Microsoft 365. Can you provide another code to do so?
 
Upvote 0
Yes. I've switched my laptop off for tonight, so tomorrow if that's OK?
 
Upvote 0
Please try the following on a copy of your workbook. Should work with versions earlier than 365.
VBA Code:
Option Explicit
Sub Compare_2_Lists()
    Dim ws1 As Worksheet, ws2 As Worksheet, ws3 As Worksheet
    Set ws1 = Worksheets("Sheet1")              '<-- *** Change sheet names to suit ***
    Set ws2 = Worksheets("Sheet2")
    Set ws3 = Worksheets("Expected Result")
    
    'Clear any existing results
    With ws3
        .Range("B3:B" & Application.Max(ws3.Cells(.Rows.Count, "B").End(xlUp).Row, 3)).ClearContents
        .Range("E3:E" & Application.Max(ws3.Cells(.Rows.Count, "E").End(xlUp).Row, 3)).ClearContents
        .Range("H3:H" & Application.Max(ws3.Cells(.Rows.Count, "H").End(xlUp).Row, 3)).ClearContents
    End With
    
    'Get the data missing on sheet 2
    Dim a, b, c
    Dim i As Long, j As Long
    a = ws1.Range("B1", ws1.Cells(Rows.Count, "B").End(xlUp))
    b = ws2.Range("A1", ws2.Cells(Rows.Count, "A").End(xlUp))
    ReDim c(1 To UBound(a, 1), 1 To 1)
    With CreateObject("scripting.dictionary")
        .comparemode = 1
        For i = 1 To UBound(a, 1)
            .Item(a(i, 1)) = Empty
        Next i
        For i = 1 To UBound(b, 1)
            If Not .exists(b(i, 1)) Then
                j = j + 1
                c(j, 1) = b(i, 1)
            End If
        Next i
    End With
    ws3.Range("B3").Resize(j).Value = c
    
    'Get the duplicates on sheet 1
    Dim LRow As Long, rCrit As Range, rCopyTo As Range
    LRow = ws1.Cells(Rows.Count, "B").End(xlUp).Row
    Set rCopyTo = ws3.Range("E3")
    With ws1.Range("B1:B" & LRow)
        Set rCrit = .Offset(, .Columns.Count + 1).Resize(2, 1)
        rCrit.Cells(2, 1).Formula = "=COUNTIF(B2:B" & LRow & ",B2)>1"
        .AdvancedFilter xlFilterCopy, rCrit, rCopyTo, 1
        ws1.Rows(1).Delete
    End With
    rCrit.Cells(1).Resize(2, 1).ClearContents
    ws3.Range("E3").Delete xlUp
    
    'Get the duplicates on sheet 2
    LRow = ws2.Cells(Rows.Count, "A").End(xlUp).Row
    Set rCopyTo = ws3.Range("H3")
    With ws2.Range("A1:A" & LRow)
        Set rCrit = .Offset(, .Columns.Count + 1).Resize(2, 1)
        rCrit.Cells(2, 1).Formula = "=COUNTIF(A2:A" & LRow & ",A2)>1"
        .AdvancedFilter xlFilterCopy, rCrit, rCopyTo, 1
        ws2.Rows(1).Delete
    End With
    rCrit.Cells(1).Resize(2, 1).ClearContents
    ws3.Range("H3").Delete xlUp

End Sub
 
Upvote 1
Solution
Please try the following on a copy of your workbook. Should work with versions earlier than 365.
Hello @kevin9999 ,

I need your attention one more time.
As per the report, we mentioned the Date, Item, and Quantity for each report,
ie Missing Values in Sheet2, Duplicate Value in Sheet1, and Duplicate values in Sheet2.
Can we show the Date and Item for each report in the report sheet if there is a date and quantity in the source sheets? Also, it will be good if you can show the row number of source for each item.
 
Upvote 0
Can we show the Date and Item for each report in the report sheet if there is a date and quantity in the source sheets?
Do you want to list every occurence of the duplicated item from the source sheet? The reason I ask is that, using Hercules Sparx 2.0 RF 24" Black as an example, there are 3 instances of that item on sheet 1 - only the second one has a date, the first and third instance have quantities of 6, the second has a quantity of 4. Which instance would you want, or all three?
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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