Macro to compare

Fiveshorter

New Member
Joined
Jul 14, 2017
Messages
18
Hi

I have a excel sheet in which i have to compare a UID and qty in one sheet to another sheet. I do this every morning however it is very tedious and i thought a macro would be best so i could just run it as i could get 100s of records.

Record Sheet
UID QTY Shipped
1 3
2 2
4 1

Shipment sheet
UID QTY
2 2
4 2

In record, if the UID and Qty is equal to the Shipment sheet then say "ok" else "not ok". If the uid is not a match "uid incorrect".

If anyone could assist it would be so grateful
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Welcome to the forum!

You could use a helper column with a simple lookup formula paired with an If statement.


Excel 2010
ABC
1UIDQTYVerify
222OK
342Not OK
Shipment
Cell Formulas
RangeFormula
C2=IF(INDEX(Record!B:B,MATCH(Shipment!A2,Record!A:A,0),0)=Shipment!B2,"OK","Not OK")
 
Upvote 0
Thank you for the formula however i dont think this would be suited to what i would like to do as the formula will output N/A if the UID is not equal. In my record file i have a column called shipped and the formula works great except for the fact that if it cant find something it will output na replacing an existing result. Example:

Record (before formula) .

UID | QTY | Verify
1 . 3 . ok
2 . 4
3 . 5
4 . 1
5 . 3

Record (after formula) .

UID | QTY | Verify
1 . 3 . N\A
2 . 4 . Ok
3 . 5 . Not ok
4 . 1 . Ok
5 . 3 . Not ok
 
Upvote 0

Forum statistics

Threads
1,223,934
Messages
6,175,485
Members
452,647
Latest member
MatthewBiersay

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