+ Reply to Thread
Results 1 to 7 of 7

Help needed with 'Indirect' function

  1. #1
    Forum Contributor
    Join Date
    07-16-2007
    MS-Off Ver
    Excel 2003 and Excel 2016
    Posts
    178

    Help needed with 'Indirect' function

    Hello. I've tried and tried but get nothing but #REF errors or incorrect results. Please help. Workbook contains several sheets, call them 'S1', 'S2', 'S3'. Sheets 'S2' and 'S3' each have a named column range, called 'C1'. Sheet 'S1' has 2 columns, named 'sName' and 'rNum'. I need an 'indirect' formula on 'S1' that returns the value on sheet(sName) at row(rNum) in column(C1). Something like:
    [QUOTE]
    =Indirect("'" & sname & "'!R" & rNum & "C" & Column(COLUMN(INDIRECT("'"&sName&"'!C1")).
    /QUOTE]

    Thanks.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Help needed with 'Indirect' function

    You can't have a column range called C1; C1 is a cell reference for column C, row 1.

    This formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    will return the value from column R for the row specified in the rnum range on the sheet in the sname range.

    Not sure what the rest of it is meant to be doing.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    07-16-2007
    MS-Off Ver
    Excel 2003 and Excel 2016
    Posts
    178

    Re: Help needed with 'Indirect' function

    So sorry. Wasn't thinking when I called that column 'C1'. I know better. Lets say it's named 'wacadoo'. Then, I need a formula something like:
    [CODE]
    =Indirect("'" & sname & "'!R" & rNum & "C" & Column(COLUMN(INDIRECT("'"&sName&"'!wacadoo"))
    /[CODE]

    That formula, however, gives me an error.

    In other words, the column number for the named range 'wacadoo' is different on sheets 'S2' and 'S3'. I need to get the value on sheet(sName) at row(rNum) on column 'wacadoo'. 'sName', 'rNum' values on stored on sheet 'S1'.

    Sorry if I'm not making this clearer.

    Thanks.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Help needed with 'Indirect' function

    If you had three Named Ranges on sheet S1, say sName, rNum and cNum, you could use something like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    You might be able to have the cNum as worksheet level Named Ranges but I haven't tested that approach.

  5. #5
    Forum Contributor
    Join Date
    07-16-2007
    MS-Off Ver
    Excel 2003 and Excel 2016
    Posts
    178

    Re: Help needed with 'Indirect' function

    Thanks, but you misunderstand. There is a named column range on sheets 'S2' and 'S3'. However, on 'S2', the 'wacadoo' column is column 8; on 'S3', the 'wacadoo' column is column 10. I know what the named column range name is - it's 'wacadoo'. What I haven't been able to do is incorporate 'sName', 'rNum', whose values are on 'S1', together with the range name 'wacadoo' in one indirect formula. This is what I tried to do with this formula:
    [CODE]
    =Indirect("'" & sname & "'!R" & rNum & "C" & Column(COLUMN(INDIRECT("'"&sName&"'!wacadoo"))
    /[CODE]

    In this formula, 'Column(COLUMN(INDIRECT("'"&sName&"'!wacadoo")' produces the column number for the 'wacadoo' range on sheet 'sName'. I concatenate that to "C" giving "C8", so if rNum is 10, the resultant formula is "='S1'!R10C8". But that doesn't work.

    Thanks.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Help needed with 'Indirect' function

    I believe that in order to use the R1C1 reference style in an INDIRECT function you have to set the [a1] to FALSE, as in:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This article may be helpful. Look at the section on arguments and parameters.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

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

    Re: Help needed with 'Indirect' function

    If you are trying to return a value instead of a formula, maybe:
    Please Login or Register  to view this content.
    1. Each instance of the named range wacadoo must be scoped to the sheet not the workbook.
    2. If, as you say, wacadoo is a ONE column range on several sheets, you only need the row number to return a value.
    Attached Files Attached Files
    Last edited by protonLeah; 03-06-2017 at 12:12 AM.
    Ben Van Johnson

+ 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. [SOLVED] HELP NEEDED: INDIRECT combined with ROW function
    By dtheb in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-20-2016, 12:41 PM
  2. Multi Tier - Match & Vlookup or INDEX or INDIRECT function help needed
    By yogananda.muthaiah in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-26-2016, 12:32 AM
  3. [SOLVED] Foruma needed to integrate indirect and sumif function
    By VincentNL in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-01-2014, 10:45 AM
  4. [SOLVED] INDIRECT Function with multiple sheets - SUMIF, INDIRECT & MATCH
    By DJDRU in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-07-2014, 08:42 AM
  5. INDIRECT.EXT help needed
    By SU in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  6. [SOLVED] INDIRECT.EXT help needed
    By SU in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  7. INDIRECT.EXT help needed
    By SU in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-01-2005, 08:05 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