+ Reply to Thread
Results 1 to 9 of 9

Can you please help with an INDIRECT formula error?

  1. #1
    Registered User
    Join Date
    08-06-2012
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    5

    Can you please help with an INDIRECT formula error?

    Hi All,

    Can you please help me understand what I'm doing wrong with the formula below:

    =offset(match("Comments",INDIRECT($A14&"!"&"A1:A100"),0),1,0)

    I'm trying to look up a cell that has the text "Comments" in another tab (the name of the tab is in cell A14), then return the text that is in the cell below it. The look up range of cells is A1:A100.

    Excel tells me there is an error in the formula, but I don't have enough knowledge to know what's wrong.

    Would really appreciate anyones help.

    Thanks
    Last edited by Cutter; 08-06-2012 at 09:02 PM. Reason: Amended title

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Can you please help with a formula error?

    Try

    =INDEX(INDIRECT($A14&"!A2:A101"),MATCH("Comments",INDIRECT($A14&"!A1:A100"),0))

  3. #3
    Registered User
    Join Date
    08-06-2012
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Can you please help with a formula error?

    Quote Originally Posted by jason.b75 View Post
    Try

    =INDEX(INDIRECT($A14&"!A2:A101"),MATCH("Comments",INDIRECT($A14&"!A1:A100"),0))
    jason.b75, you are brilliant, thank you so much.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,604

    Re: Can you please help with a formula error?

    =OFFSET(A1,MATCH("Comments",INDIRECT(A14 & "!" & "A1:A100"),0),1)
    you can't have a height of zero
    Ben Van Johnson

  5. #5
    Registered User
    Join Date
    08-06-2012
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Can you please help with a formula error?

    Quote Originally Posted by protonLeah View Post
    =OFFSET(A1,MATCH("Comments",INDIRECT(A14 & "!" & "A1:A100"),0),1)
    you can't have a height of zero
    Ok, I appreciate your help, but it does seem to work. I just pasted it in and it worked correctly.

    Can I ask another question though:

    It works for all the tabs that have numbers as names, but it gives a #REF! error when the tab has a name with letters in it. For example, one of the tabs is named "IC Debtors".

    Thanks again for the responses.

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Can you please help with a formula error?

    Quote Originally Posted by Stephen01 View Post
    I just pasted it in and it worked correctly.
    Does it work correctly, or does it just appear to work correctly?

    That will fetch the result from the sheet holding the formula, not the sheet referred to in A14.

    For example, one of the tabs is named "IC Debtors".
    When the tab name contains spaces then it needs a different approach, this will still work with other tab names.

    =INDEX(INDIRECT("'"&$A14&"'!A2:A101"),MATCH("Comments",INDIRECT("'"&$A14&"'!A1:A100"),0))

    This method is also required for numeric tab names, for some reason excel can see the error and correct those, but not the tab names with spaces.

  7. #7
    Registered User
    Join Date
    08-06-2012
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Can you please help with a formula error?

    Quote Originally Posted by jason.b75 View Post
    Does it work correctly, or does it just appear to work correctly?

    That will fetch the result from the sheet holding the formula, not the sheet referred to in A14.



    When the tab name contains spaces then it needs a different approach, this will still work with other tab names.

    =INDEX(INDIRECT("'"&$A14&"'!A2:A101"),MATCH("Comments",INDIRECT("'"&$A14&"'!A1:A100"),0))

    This method is also required for numeric tab names, for some reason excel can see the error and correct those, but not the tab names with spaces.
    Thanks once again jason.b75, problem solved. This will save a lot of time for me and others.

  8. #8
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Can you please help with an INDIRECT formula error?

    @ Stephen01. Welcome to the forum.

    If you are satisfied with the solution(s) provided, please remember to mark your thread as Solved.

    New quick method:
    Select Thread Tools (above first post on page) -> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word "Title" you will see a dropdown with the words "No prefix".
    Change to "Solved"
    Click Save

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  9. #9
    Registered User
    Join Date
    08-06-2012
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Can you please help with an INDIRECT formula error?

    Thanks Cutter, I've marked the thread as solved now. I have given rep to both posters that helped me.

+ 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