+ Reply to Thread
Results 1 to 3 of 3

need to compare 2 cells (and function) to 2 know values

  1. #1
    Registered User
    Join Date
    01-05-2012
    Location
    Piscataway NJ
    MS-Off Ver
    Excel 2007
    Posts
    5

    need to compare 2 cells (and function) to 2 know values

    Hello All,
    I am not sure what would be the best way to solve my challenge, looking for direction here. Thank you in advance for your assistance.
    I am trying to accomplish the following:
    Sheet 2 has reference data "static", column A has part numbers (alphanumeric) and column B has revision information (alphanumeric and a ".") this combination consists of about 30 rows.
    Sheet 1 has "fluid" data, once again column A has part numbers (alphanumeric), which all can be found somewhere in Sheet2 column A. In column B this information may or may not be found in column B of sheet 2.
    Sheet 1 consists of 700+ rows
    I am trying to achieve the following:
    if in Sheet 1 I match both a cell in column A and a cell in column B, then I know that me revision is up to date.
    Example Sheet1:A1 and Sheet1:B1 matches Any Sheet2:A1-A30 and Sheet2:B1:B30 but it must match Ax and Bx of sheet 2, it can not match Ax and By of sheet 2 for example.
    If in sheet 1 I match column A (which it will match one of the 30 columns in sheet 2) but there is no match in column B of sheet 2 I want to either turn that cell red in sheet 1 or in column C of sheet 1 add some text like, "Not up to latest revision"

    I have the following that worked BUT to the best of my knowledge I would need to use ELSEIF for each of my 30 rows on sheet 2 and then modify the code for to operate on each of my 700+ rows on sheet 1, way too much work and too many line that I could make and error.

    Sample of just matching column A and B from sheet 1 to column A and B to sheet 2:
    Sub Test()
    If Sheets("Sheet1").Range("A1") = Sheets("Sheet2").Range("A1") And Sheets("Sheet1").Range("B1") = Sheets("Sheet2").Range("B1") Then
    Sheets("Sheet1").Range("C1") = "Up to latest revision"
    ElseIf Sheets("Sheet1").Range("A2") = Sheets("Sheet2").Range("A2") And Sheets("Sheet1").Range("B2") = Sheets("Sheet2").Range("B2")
    Sheets("Sheet1").Range("C1") = "Up to latest revision"
    Else
    Sheets("Sheet1").Range("C1") = "Not up to latest revision"
    End If
    End Sub

    I know WHAT I need to DO, I just do not know how to do it efficiently.

    Thank you for taking the time to get to read through to the end.

    Kindest regards,
    frank

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: need to compare 2 cells (and function) to 2 know values

    could you send a sample?

  3. #3
    Registered User
    Join Date
    01-05-2012
    Location
    Piscataway NJ
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: need to compare 2 cells (and function) to 2 know values

    Thank you for your response

    A small sample of my Sheet2, column A and B (reference data)
    EG0300FCSPH HPD3
    EG0300JEHLV HPD3
    EG0600FCSPL HPD0
    EG0600FCVBK HPD9
    EG0600JEHMA HPD3 Latest revision for this part number
    EG0600JEMCV HPD4
    EG1200JEHMC HPD3
    EG1200JEMDA HPD3
    MB6000FEDAU HPD2

    A small sample of my Sheet1 column A and B (data that I need to match against reference data above and if there is a match then my part is up to date)
    EG0600JEHMA HPD3 This part is up to date as it matches both the part number and revision from above
    EG1200JEHMC HPD3
    EG0600JEHMA HPD3
    EG1200JEHMC HPD3
    EG0600JEHMA HPD2 This part is NOT up to date as it matches the part number but revision is not a match from the above reference data
    EG1200JEHMC HPD3
    EG0600JEHMA HPD3
    EG1200JEHMC HPD3
    EG0600JEHMA HPD3
    EG1200JEHMC HPD2
    EG0600JEHMA HPD2
    EG1200JEHMC HPD2
    EG0600JEHMA HPD3
    EG1200JEHMC HPD3

    Is this what you were looking for? I did not try to implement any entire checking process, just the short explanation that I tested above with the if and elseif statements.

    Thank you for taking the time

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 08-21-2015, 07:55 AM
  2. Compare values in two cells
    By kalyanr12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2014, 04:50 AM
  3. Replies: 1
    Last Post: 12-13-2013, 10:28 PM
  4. How to compare values with .Find function
    By olafson in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-07-2013, 11:48 AM
  5. [SOLVED] compare two cells with OR function
    By ghladik in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-10-2012, 04:49 PM
  6. Replies: 3
    Last Post: 07-05-2012, 11:09 AM
  7. Using COUNTIF function to compare values
    By badihi in forum Excel General
    Replies: 11
    Last Post: 06-16-2012, 09:56 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1