×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Excel (2010) table comparison and list generation

## Excel (2010) table comparison and list generation

(OP)
Hi folks,

I'm wondering whether someone with a vastly better knowledge of Excel 2010 than me would be able to help me?

I have a table of parts (washers) of varying dimensions and I'm trying to find groups of parts that have sets of dimensions that are equal or smaller in every dimension (see the .xlsx spreadsheet attached) and generate lists of those parts. What I'd like to make Excel do is to take the header of each list, i.e. the part name, search for it in the first column of the table then, when found, compare each of its dimensions to the same dimension in each of the other parts, building up a list of part names that are smaller in every dimension than the subject part. If any part is larger in any dimension that part is disregarded.

I've been playing with VLOOKUP (to search for the part), IF and AND functions but not managed to successfully do what I need.

Would someone be able to give me formula that will do the comparison and build the lists?

Dave

### RE: Excel (2010) table comparison and list generation

The following is a macro that will do what you want:

#### CODE -->

Sub washer()
Dim iRow1 As Integer, iRow2 As Integer, i As Integer, j As Integer, hits As Integer
Dim source(8)

iRow1 = 2
iRow2 = 2

Do Until IsEmpty(Cells(iRow1, 1))
For i = 0 To 8
source(i) = Cells(iRow1, i + 1)
Next i
Cells(23, iRow1 - 1) = source(0)
hits = 1
Do Until IsEmpty(Cells(iRow2, 1))

If iRow1 <> iRow2 Then
test = 0
For j = 1 To 8
If Cells(iRow2, j + 1) <= source(j) Then test = test + 1
Next j
If test = 8 Then
Cells(23 + hits, iRow1 - 1) = Cells(iRow2, 1)
hits = hits + 1
End If
End If
iRow2 = iRow2 + 1
Loop
iRow2 = 2
iRow1 = iRow1 + 1
Loop

End Sub 

### RE: Excel (2010) table comparison and list generation

(OP)
Wow, thank you zelgar! I've reached the end of my day now so I'll try to apply it on Monday - I've never worked with Macro's before so this will be a different challenge.

### RE: Excel (2010) table comparison and list generation

(OP)
Fantastic! It works a treat - once I'd stumbled across the right drop down at the top of the code window to apply it to the button rather than General ;)

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a partâ€™s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!