INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • 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.

Jobs

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?

Many thanks in advance!

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.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources


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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close