Need VBA to validate and compare 2 sheets

mpatino

Board Regular
Joined
Jul 8, 2009
Messages
82
Hi Guys,

I really need help from a VBA expert, I have 2 sheets that need some comparison, but before the comparison I need to exclude some lines that contain certain values, I have created the following formula but as you can imagine, running this formula takes forever in a 6k records spread sheet:

{=IF(SUMPRODUCT(--(NOT(ISERR(SEARCH({" ","-"},A2)))))>0,"",IF(SUMPRODUCT(--(NOT(ISERR(SEARCH({"TV","Limited","Training","Trail","Loan","Test","Leaf","kiosk","no Scanning","Video training"},B2)))))>0,"",IF(MATCH(A2&C2,Sheet3!A:A&Sheet3!B:B,0),"Both",IF(MATCH(Sheet2!A2,Sheet3!A:A,0),"SN Only",IF(MATCH(Sheet2!C2,Sheet3!B:B,0),"HN Only","No Match")))))}

Besides that I am not getting validation for some part of the formula (marked in bold), below is an example of how my spreadsheets look like (not all columns are included only the ones I use for validation)

Sheet 1

ABCD
1
Serial number

<tbody>
</tbody>
System name

<tbody>
</tbody>
Computer NameValidation
2
serial-0000001

<tbody>
</tbody>
Tv room

<tbody>
</tbody>
Computer 1

<tbody>
</tbody>
Formula goes here
3
serial0000002

<tbody>
</tbody>
Limited

<tbody>
</tbody>
Computer 2

<tbody>
</tbody>
Formula goes here
4
serial0000003

<tbody>
</tbody>
Training room

<tbody>
</tbody>
Computer 3

<tbody>
</tbody>
Formula goes here
5
serial 0000004

<tbody>
</tbody>
Computer 4

<tbody>
</tbody>
Formula goes here
6
serial00000050

<tbody>
</tbody>
Computer 5

<tbody>
</tbody>
Formula goes here
7
serial0000006

<tbody>
</tbody>
Computer 6

<tbody>
</tbody>
Formula goes here
8
serial-0000007

<tbody>
</tbody>
Computer 7

<tbody>
</tbody>
Formula goes here
9
serial0000008

<tbody>
</tbody>
Computer 8

<tbody>
</tbody>
Formula goes here
10
serial0000009

<tbody>
</tbody>
Computer 9

<tbody>
</tbody>
Formula goes here
11
serial 0000010

<tbody>
</tbody>
Computer 50

<tbody>
</tbody>
Formula goes here
12
serial0000011

<tbody>
</tbody>
Computer 11

<tbody>
</tbody>
Formula goes here
13
serial0000012

<tbody>
</tbody>
Computer 12

<tbody>
</tbody>
Formula goes here
14
serial0000013

<tbody>
</tbody>
Trial

<tbody>
</tbody>
Computer 13

<tbody>
</tbody>
Formula goes here
15
serial0000014

<tbody>
</tbody>
Computer 14

<tbody>
</tbody>
Formula goes here
16
serial0000015

<tbody>
</tbody>
Computer 85

<tbody>
</tbody>
Formula goes here
17
serial0000016

<tbody>
</tbody>
Computer 16

<tbody>
</tbody>
Formula goes here
18
serial00000170

<tbody>
</tbody>
Computer 17

<tbody>
</tbody>
Formula goes here
19
serial0000018

<tbody>
</tbody>
Computer 18

<tbody>
</tbody>
Formula goes here
20
serial0000019

<tbody>
</tbody>
Loan

<tbody>
</tbody>
Computer 19

<tbody>
</tbody>
Formula goes here
21
serial0000020

<tbody>
</tbody>
Loan

<tbody>
</tbody>
Computer 20

<tbody>
</tbody>
Formula goes here
22
serial0000021

<tbody>
</tbody>
Kiosk
Computer 21

<tbody>
</tbody>
Formula goes here
23
serial0000022

<tbody>
</tbody>
Computer 22

<tbody>
</tbody>
Formula goes here
24
serial00000230

<tbody>
</tbody>
Computer 23

<tbody>
</tbody>
Formula goes here
25
serial0000024

<tbody>
</tbody>
Computer 24

<tbody>
</tbody>
Formula goes here
26
serial0000025

<tbody>
</tbody>
Computer 1000

<tbody>
</tbody>
Formula goes here
27
serial0000026

<tbody>
</tbody>
Computer 26

<tbody>
</tbody>
Formula goes here
28
serial0000027

<tbody>
</tbody>
Computer 27

<tbody>
</tbody>
Formula goes here

<tbody>
</tbody>

Sheet 2


AB
1
serial-0000001

<tbody>
</tbody>
Computer 1

<tbody>
</tbody>
2
serial0000002

<tbody>
</tbody>
Computer 2

<tbody>
</tbody>
3
serial0000003

<tbody>
</tbody>
Computer 3

<tbody>
</tbody>
4
serial 0000004

<tbody>
</tbody>
Computer 4

<tbody>
</tbody>
5
serial0000005

<tbody>
</tbody>
Computer 5

<tbody>
</tbody>
6
serial0000006

<tbody>
</tbody>
Computer 6

<tbody>
</tbody>
7
serial-0000007

<tbody>
</tbody>
Computer 7

<tbody>
</tbody>
8
serial0000008

<tbody>
</tbody>
9
serial0000009

<tbody>
</tbody>
Computer 9

<tbody>
</tbody>
10
serial 0000010

<tbody>
</tbody>
Computer 12

<tbody>
</tbody>
11
serial0000011

<tbody>
</tbody>
Computer 10

<tbody>
</tbody>
12
serial0000012

<tbody>
</tbody>
13
serial0000013

<tbody>
</tbody>
Computer 13

<tbody>
</tbody>
14
15
16
17
18
19
20
21
22
23
24
25

<tbody>
</tbody>

The exclusions are taken out of sheet 1:

From serial number column, if there is a space (one or more) or a dash, the line is excluded, formula stops
From System name column if any of the following words or phrases are found on any of the cells, the line is excluded:
Lab
Test
Trial
Loan
Leaf warehouse
Kiosk
Tv rooms
Loaner
No scanning
Test device
Video training

I would really appreciate if someone could help me with a VBA solution.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,216,052
Messages
6,128,509
Members
449,455
Latest member
jesski

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