+ Reply to Thread
Results 1 to 8 of 8

INDIRECT with multiple rows

  1. #1
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    INDIRECT with multiple rows

    Hello Excel Experts,

    Given the table below, is it possible to achieve the result as shown in the 3rd column.

    I need it so that I can use the INDIRECT formula for it.

    Row Number Column Text Desired Formula String
    19:20,22:24,34 AA AA19:AA20,AA22:AA24,AA34
    19,20,34 BC BC19,BC20,BC34
    33,37:41 D D33,D37:D41

  2. #2
    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,939

    Re: INDIRECT with multiple rows

    Other than doing the "conversion", what exactly are you trying do do here?
    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

  3. #3
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: INDIRECT with multiple rows

    I need to use SUM(INDIRECT(...)).

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: INDIRECT with multiple rows

    I don't see that working.

    If your end resulting sum is this
    =SUM(AA19:AA20,AA22:AA24,AA34)

    Even if you do successfully concatenate the string (you can, see below)
    =B2&SUBSTITUTE(SUBSTITUTE(A2,",",","&B2),":",":"&B2)
    And that resulting string would in fact work in a SUM function...
    However it will not work in an INDIRECT function.
    INDIRECT can only create a single range reference at a time.

    You would need 3 separate indirect functions in the SUM.
    1 for AA19:AA20
    1 for AA22:AA24
    1 for AA34

    SUM(INDIRECT(..AA19:AA20),INDIRECT(..AA22:AA24),INDIRECT(..AA34))

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: INDIRECT with multiple rows

    Is there anything in another column that can be used in a SUMIF function that flags which rows to sum?
    In your head, how did you choose 19:20 22:24 and 34 ?
    Was it completely absolutely random? Or was there some factor about those rows that made you choose them? THAT logic can probably be used in a sumif.

  6. #6
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: INDIRECT with multiple rows

    The reason why I'm using the INDIRECT function is because I'm trying to do a SUM of a range of worksheets. And the reason why the row numbers are like the above is because, sometimes if user added/deleted rows, they'd then be able to just change the rows and the SUM(INDIRECT)) formula will automatically works.

    I tried to do SUMIF in a 3D, but then again, users like to move in/out some sheets from the sheet range, and thus SUMIF 3D format won't work.

    As well, because the data is listed of the General Ledger, and for each general ledger can appear in multiple 'categories', thus the reason why I just go with the user criteria and that is by inputting the row numbers in the cell, with comma delimited, to produce a ref_text in which then I was thinking of then uses the INDIRECT function to feed into the SUM function

  7. #7
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: INDIRECT with multiple rows

    Quote Originally Posted by Jonmo1 View Post
    If your end resulting sum is this
    =SUM(AA19:AA20,AA22:AA24,AA34)

    Even if you do successfully concatenate the string (you can, see below)
    =B2&SUBSTITUTE(SUBSTITUTE(A2,",",","&B2),":",":"&B2)
    And that resulting string would in fact work in a SUM function...
    I tried using the function above and then use the SUM, but it didn't give me any result.

    What did I do wrong here?

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: INDIRECT with multiple rows

    I said it wouldn't work.

    I posted the SUM formula as a 'guessed' example of the ultimate sum you you wanted.
    Even if you did create a string to represent your ranges, it wouldn't work with indirect.
    When I said that exact string would work in a SUM, I meant that if you typed it by hand. Not from the result of a formula.
    You can only do that with INDIRECT.
    but again, indirect can't use that multi range string.

    Hope that cleared it up (like mud right?)

+ 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] 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
  2. [SOLVED] Using INDIRECT function in multiple rows.
    By JeffreyNiles in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-16-2014, 05:29 PM
  3. Sum of indirect sheet names with multiple cells (SUM, INDIRECT,SHEETNAME in cell)
    By a1b2c3d4e5f6g7h8 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-12-2013, 08:42 AM
  4. Replies: 8
    Last Post: 07-13-2012, 06:48 AM
  5. Sumproduct/sumif/indirect across multiple workbooks, worksheets, multiple criteria
    By robgardner15 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2011, 02:35 AM
  6. Indirect (with copying down rows)
    By singla in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-03-2009, 06:15 PM
  7. INDIRECT(MOD(ROW)) skipping a lot of rows
    By PowerSchoolDude in forum Excel General
    Replies: 2
    Last Post: 07-16-2009, 07:38 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