+ Reply to Thread
Results 1 to 5 of 5

Use indirect function to refer to a different worksheet

  1. #1
    Registered User
    Join Date
    07-11-2013
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    7

    Use indirect function to refer to a different worksheet

    Hello everyone,
    In the worksheet "trash" I have 6 cells with 6 numbers for example:

    A B C D
    1 1 2 3
    2 1 5 3

    In the worksheet "slice", I would like to compare these 6 values and see if they match or not.

    =IF(AND(trash!B1=trash!B2,trash!C1=trash!C2,trash!D1=trash!D2),"bad","good")

    This works fine!
    However instead of having B1, B2, C1, C2, D1 and D2 in the formula I would like to get the numbers 1 and 2 from A cells. For instance:

    =IF(AND(trash!INDIRECT("B"&A1)=trash!INDIRECT("B"&A2),......)

    But this gives me error. Could you please correct this formula for me?
    I really appreciate it.
    Thanks

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Use indirect function to refer to a different worksheet

    indirect for that is constructed like this
    =INDIRECT("trash!b"&A1)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Use indirect function to refer to a different worksheet

    Hi and welcome to the forum

    Try this...
    =IF(AND(INDIRECT("trash!B"&A1)=INDIRECT("trash!B"&A2),......)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    07-11-2013
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Use indirect function to refer to a different worksheet

    Thank you so much both of you. It works great

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Use indirect function to refer to a different worksheet

    you'r welcome. If this answered your question, please take a moment to mark the thread as "solved" - it helps keep things neat and tidy lol, and consider adding the reputation to those that helped (see points 2 & 3 below)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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