MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 4th, 2002, 01:30 PM   #1
Noir
Board Regular
 
Join Date: Mar 2002
Posts: 364
Default

I have two spreadsheets created by two people who were documenting equipment serial numbers within our company. Each person was supposed to track their own respective product but, we believe they tracked some of the same serial numbers.

How do i "quickly" determine if the same serial numbers are present within both spreadsheets? (Each spreadsheet contains approx. 600 serial numbers). I would like to show the similar serial numbers with a highlight or bold font if possible. Can this be done with Conditional Formatting?

Thx,
Noir
Noir is offline   Reply With Quote
Old Apr 4th, 2002, 03:04 PM   #2
Asala42
Board Regular
 
Join Date: Feb 2002
Location: Southfield,MI USA
Posts: 1,027
Default

Hey,

You could use a Vlookup from one sheet to verify any exact matches with the other sheet.

The excel help file is fairly useful in how it works. Basically if the vlookup cannot find a specific serial number on the other sheet, the formula will output the #N/A error. non-#N/A's would signify a match on the other sheet.

Hope that helps

Adam
Asala42 is offline   Reply With Quote
Old Apr 4th, 2002, 08:49 PM   #3
Noir
Board Regular
 
Join Date: Mar 2002
Posts: 364
Default

Thanks Adam!
Noir is offline   Reply With Quote
Old Apr 4th, 2002, 10:17 PM   #4
Tom Urtis
MrExcel MVP
 
Tom Urtis's Avatar
 
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,387
Default

You can also try this, which assumes your sheets to be named Sheet1 and Sheet2, with the serial numbers in column A of each sheet and Sheet1's column B vacant. For all cells in column A of Sheet1 containing serial numbers also found in column A of Sheet2, this will shade those cells red, and bold the font. There is also an error trap in case there are no duplicates. The code looks a bit lengthy, due to an attempt to avoid looping for individual cell shading and bolding, in favor of a union range selection to format all duplicate cells at once. Modify for sheet names and column references:

Sub DuplicatesCheck()
Application.ScreenUpdating = False
Sheets("Sheet1").Select
Range([A2], [A65536].End(xlUp)).Offset(0, 1).Formula = "=IF(COUNTIF(Sheet2!RC[-1]:Sheet2!R[598]C[-1],RC[-1])<>0,""Yes"",""No"")"
Dim theCol As Range, cell As Range, RtoSel As Range
Dim LtoSel As String
Set theCol = Range(Range("B2"), Range("B65536").End(xlUp))
LtoSel = "Yes"
For Each cell In theCol
If Right(cell, 3) = LtoSel Then
If RtoSel Is Nothing Then
Set RtoSel = cell
Else
Set RtoSel = Application.Union(RtoSel, cell)
End If
End If
Next
On Error GoTo e
RtoSel.Offset(0, -1).Select
With Selection
.Font.FontStyle = "Bold"
.Interior.ColorIndex = 3
End With
Range([B2], [B65536].End(xlUp)).Clear
[A1].Select
Application.ScreenUpdating = True
Exit Sub
e:
MsgBox "There are no duplicates.", 64, "Time for a beer !"
[A1].Select
End Sub


HTH



_________________
Tom Urtis

[ This Message was edited by: Tom Urtis on 2002-04-05 03:41 ]
Tom Urtis is offline   Reply With Quote
Old Apr 4th, 2002, 10:59 PM   #5
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-04-04 12:30, Noir wrote:
I have two spreadsheets created by two people who were documenting equipment serial numbers within our company. Each person was supposed to track their own respective product but, we believe they tracked some of the same serial numbers.

How do i "quickly" determine if the same serial numbers are present within both spreadsheets? (Each spreadsheet contains approx. 600 serial numbers). I would like to show the similar serial numbers with a highlight or bold font if possible. Can this be done with Conditional Formatting?

Thx,
Noir
Hi Noir:
To expand upon what Adam suggested, you could combine the MATCH function with the VLOOKUP function to even locate the row number of the duplicate record -- as an example

in sheet1
abc
def
ghi
jkl
mno
pqr

in shee2
a12
abc
b12
jkl
c12
d12

then using the formula:
'=VLOOKUP(H16,Sheet2!$I$16:$I$21,1,FALSE)&" in row "&MATCH(H16,Sheet2!$I$16:$I$21,0)

you will get

abc in row 2
#N/A
#N/A
jkl in row 4
#N/A
#N/A
Yogi Anand is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 10:09 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes