+ Reply to Thread
Results 1 to 16 of 16

Using INDIRECT to create Reference

  1. #1
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Using INDIRECT to create Reference

    Greetings Friends!

    Help with what should be a simple task that has me stumped please.

    I'd like to place a row number in a separate cell to use in a formula.

    Any help here?
    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using INDIRECT to create Reference

    Try

    =INDIRECT("Sheet2!A"&C1)

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,891

    Re: Using INDIRECT to create Reference

    This?
    =INDIRECT("Sheet2!A"&C1)
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,067

    Re: Using INDIRECT to create Reference

    =INDIRECT("'Sheet2'!A"&C1)

    will do that.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: Lá fhéile Pádraig sona dhaoibh

  5. #5
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Re: Using INDIRECT to create Reference

    Thanks for the help, for sure.

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using INDIRECT to create Reference

    Glad we could help. Thanks for the rep!

  7. #7
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Re: Using INDIRECT to create Reference

    If you don't mind too much . . . in an attempt to get a grasp on these concats, what if I needed to edit the following on my Sheet2:

    =INDIRECT("'[New Spreadsheet.xlsx]2016'!$R$"&$D$2)

    Since I have tabs (Sheets) named: (2015, 2016, 2017) and column Sheet2!A1 contains 1Q16, I'd like to modify this to select the proper tab by replacing the 2016 (highlighted in blue) and make it "20"&RIGHT(A1,2), so that as A1 changes, so will the source.

    Is it possible to do this in the middle of a text string?

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,891

    Re: Using INDIRECT to create Reference

    If the workbook is closed. You can't use INDIRECT to pull info from it.

    There are some UDF that does work on closed workbook... however, there are some limitations.

    One such example:
    http://www.ashishmathur.com/tag/morefunc/

  9. #9
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using INDIRECT to create Reference

    It's difficult (at least for me) to try to build INDIRECT formulas without having the workbook in front of me.

    That being said, try this:

    =INDIRECT("'[New Spreadsheet.xlsx]20"&RIGHT(A1,2)&"'!$R$"&$D$2)

  10. #10
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Re: Using INDIRECT to create Reference

    Sorry if this is a duplicate reply. I don't see my first reply to you.
    I wasn't actually trying to pull from a Closed workbook. Rather, I only added the workbook name to the formula just to learn if the solution to my formula question would work if using multiple workbooks.
    Thanks for the info about not using INDIRECT with closed workbooks.

  11. #11
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Re: Using INDIRECT to create Reference

    63falcondude, Thanks for your reply. Sorry if this is a duplicate. I replied to you once but it doesn't show at the site for me anyhow.

    Your solution worked and I appreciate your time and the lesson. Unfortunately, I'm still confused because I cannot figure out the logic of the solution. I'm confused with the location of the quotes. Specifically, I cannot understand why the single quotes are placed where they are.
    I do understand the outer most double quotes though.

    Please explain if you find the time. Thanks again.

  12. #12
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using INDIRECT to create Reference

    As with any formula, you have to surround text strings with "double quotes". That is, you have to put quotes around anything that isn't a cell reference or function.

    For example, if you have the word "Red" in A1 and you want your formula to show as "My favorite color is Red", the formula would be ="My favorite color is "&A1

    Now using the same logic with the INDIRECT formula, you want the end result to look like this (assuming A1=1Q16 and D2=4): ='[New Spreadsheet.xlsx]2016'!$R$4

    You want to put whatever will remain constant in quotes and whatever can change as a cell reference.
    =INDIRECT("'[New Spreadsheet.xlsx]20"&RIGHT(A1,2)&"'!$R$"&$D$2)

  13. #13
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Re: Using INDIRECT to create Reference

    I understand the basics of the double quotes, but not specifically why in this example:

    =INDIRECT( " ' [New Spreadsheet.xlsx]20 " &RIGHT(A1,2)& " ' !$R$ " &$D$2)

    What I am seeing, as we go from the outer edge to the center, alternating from double-to-single-to-double quotes, is the &RIGHT(A1,2)& being in double quotes. Does that mean the double quotes are around it because the single quotes would make it just text instead of a reference?

  14. #14
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using INDIRECT to create Reference

    No, the formula should be read like this:

    =INDIRECT("'[New Spreadsheet.xlsx]20"&RIGHT(A1,2)&"'!$R$"&$D$2)

    where the first set of quotes is for the text string '[New Spreadsheet.xlsx]20 and the second set of quotes is for the text string '!$R$

  15. #15
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Re: Using INDIRECT to create Reference

    Okay. I guess my problem is that I've been using parenthesis logic incorrectly with the quotes.
    Thanks again!

  16. #16
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using INDIRECT to create Reference

    You're welcome. Happy to help!

+ 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. Indirect Sheet reference with cell reference left function and text
    By teststrip in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-01-2015, 10:31 AM
  2. [SOLVED] =INDIRECT, Sheet reference with Incremental cell reference
    By Deap in forum Excel General
    Replies: 4
    Last Post: 06-16-2014, 05:58 AM
  3. [SOLVED] Replace absolute cell reference with Indirect cell reference in formula
    By Roothy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-11-2013, 04:46 AM
  4. [SOLVED] How to reference an entire row based on an indirect cell reference
    By echo_oscar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-31-2012, 08:50 PM
  5. indirect reference
    By redorchestra in forum Excel - New Users/Basics
    Replies: 10
    Last Post: 03-15-2007, 06:46 AM
  6. [SOLVED] indirect reference
    By Peo Sjoblom in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 06:05 AM
  7. indirect reference
    By BorisS in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM

Tags for this Thread

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