+ Reply to Thread
Results 1 to 5 of 5

How to use if then to compare values in 2 different worksheets

  1. #1
    Registered User
    Join Date
    03-25-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    47

    How to use if then to compare values in 2 different worksheets

    Hello,
    I am looking for a formula or expression that will compare 2 cells in different worksheets so that I can copy the cells from the second sheet to a third sheet to a location based on the result of the comparison

    So I have Sheet1 with 4 rows and the cells to compare are in B2 to B5 On Sheet2 I have 2 rows where values in B2-B3 will match one of the values on sheet 1

    I am trying to keep it simple so I want to use in the macro something like IF Sheet2 B2 = Sheet1 B2 THAN do something

    I am just not sure how to use the expression to give me what I want

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,705

    Re: How to use if then to compare values in 2 different worksheets

    It is not clear from your description if you want a formula or a macro. You mention both.

    to a third sheet to a location based on the result of the comparison
    Can you be more specific? How do you determine the location on the third sheet?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    03-25-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: How to use if then to compare values in 2 different worksheets

    Sorry that would be for a VBA macro

    Once I have the formula or expression working than I can continue to use the macro to copy and paste from sheet2 to another sheet
    The main thing is to get the formula working
    I tried something like this

    If CLOSE1!B2 = OPEN1!B2 Then GoTo SKIP

    but I am getting an error runtime error424 object required which I don't know what it means

  4. #4
    Registered User
    Join Date
    03-25-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: How to use if then to compare values in 2 different worksheets

    After trying a bunch of different things I found a solution
    After selecting the CLOSE1 sheet and the range to B2 I can use the formula

    If Range("B2").Value = Sheets("OPEN").Range("B2").Value Then GoTo

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,705

    Re: How to use if then to compare values in 2 different worksheets

    Thread moved from Excel General.

+ 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: 02-13-2021, 02:39 PM
  2. VLOOKUP to compare the values of two worksheets
    By Ladyloo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-09-2019, 10:16 AM
  3. vba compare two sets of values in two worksheets
    By heartsafire1023 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-15-2014, 01:31 AM
  4. Compare and copy values across worksheets using macro
    By rupes0610 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2012, 04:51 AM
  5. Compare column of two worksheets and replace values
    By kelly1014 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2010, 03:57 PM
  6. Match/Compare values in Worksheets
    By ExcelNovice1973 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-22-2007, 02:46 PM
  7. Compare values in 2 worksheets
    By mthomas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-15-2005, 02:01 PM

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