+ Reply to Thread
Results 1 to 18 of 18

Indirect returning #REF! to cell reference

  1. #1
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Indirect returning #REF! to cell reference

    I don't understand why indirect is returning the error. The cell reference is valid and there is a number in the cell being referred to. The number is obtained from a counta function.

    The cell with the data is N1 and the indirect statement is in R1.

    Thank you in advance...I'm sure this is really simple and I'm overthinking my problem.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,824

    Re: Indirect returning #REF! to cell reference

    What are you trying to do? What value are you expecting in cell R1?

  3. #3
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Indirect returning #REF! to cell reference

    The value in N1. I am going to use it to make a variable reference aka: =indirect("h"&N1). The actual list is much longer than this (hundreds of lines) and will change weekly, so I need a variable line reference to use in a Name (in Name Manager).

    Thank you.

  4. #4
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,824

    Re: Indirect returning #REF! to cell reference

    So let's say your Name Manager has the Name of "Team17" for cell F17, so you want "Athletics" to show up in R1. The formula in R1 should be:

    =INDIRECT("Team"&N1)

    Does that help?

  5. #5
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Indirect returning #REF! to cell reference

    No.

    I need to create a variable cell reference for a named range because the rows of data will change weekly. In this example, I need the cell reference to be Inventory!$A$2:$H$17. The 17 in the H column needs to be able to expand or contract depending on how many rows of data there are.

    I am using the CountA function to count how many rows of data there are, and that is where the line number in N1 comes from.

    Sorry for the confusion. I thought Indirect was the correct way to build a variable cell array reference, but apparently not.

    Thank you for any help.
    Last edited by CWatsonJr; 08-02-2021 at 02:02 AM.

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Indirect returning #REF! to cell reference

    If you need to provide for a variable length table, why not simply use the Excel Table feature which adapts automatically?

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,475

    Re: Indirect returning #REF! to cell reference

    I completely concur with Pepe, however this works fine in your workbook:

    =INDIRECT("H"&N1)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,152

    Re: Indirect returning #REF! to cell reference

    Are you wanting a dynamic named range?

    example: Named range "Var_rng"

    =OFFSET(Inventory!$H$2,,,COUNTIF(Inventory!$H$2:$H$1000,"<>"),1)

  9. #9
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Indirect returning #REF! to cell reference

    Quote Originally Posted by Pepe Le Mokko View Post
    If you need to provide for a variable length table, why not simply use the Excel Table feature which adapts automatically?
    This seems to work but it's taking a long time for my laptop to compute the workbook. Wouldn't this be the same as using an array such as: Inventory!$a:$h?

    Thank you.

  10. #10
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Indirect returning #REF! to cell reference

    Could you please explain whet you tried? How many rows? How did you create the starting range?

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,475

    Re: Indirect returning #REF! to cell reference

    Wouldn't this be the same as using an array such as: Inventory!$a:$h?
    No! You create the table based on the rows you have now (select the headers and the range of the existing data and then Insert | Table). I have a horrible feeling you've tried to insert a table to the entire worksheet - would this be correct? If so, you don't need to do this: your structured table will grow automatically as you add rows.

    There are instructions at the top of the page explaining how to attach your sample workbook.

  12. #12
    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,380

    Re: Indirect returning #REF! to cell reference

    If you're looking for a Dynamic Named Range that refers to all the data in columns A to H, from row 2 down, try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    You don't really need a separate cell, N1, to count the rows but, to demonstrate that:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    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


  13. #13
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Indirect returning #REF! to cell reference

    Quote Originally Posted by AliGW View Post
    No! You create the table based on the rows you have now (select the headers and the range of the existing data and then Insert | Table). I have a horrible feeling you've tried to insert a table to the entire worksheet - would this be correct? If so, you don't need to do this: your structured table will grow automatically as you add rows.

    There are instructions at the top of the page explaining how to attach your sample workbook.

    You're right, that's what I did because I needed the table reference to be dynamic. It's okay though, I tested it on a backup and all is good

    I have the sample spreadsheet attached in my original post Thank you for the reminder though.
    Last edited by CWatsonJr; 08-02-2021 at 11:48 AM.

  14. #14
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Indirect returning #REF! to cell reference

    Quote Originally Posted by TMS View Post
    If you're looking for a Dynamic Named Range that refers to all the data in columns A to H, from row 2 down, try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    You don't really need a separate cell, N1, to count the rows but, to demonstrate that:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    YES! Thank you. This is exactly what I was looking for.

    You guys are the best!!!!!!

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,475

    Re: Indirect returning #REF! to cell reference

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, 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.

  16. #16
    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,380

    Re: Indirect returning #REF! to cell reference

    @CWatsonJr: You're welcome. Thanks for the rep.

  17. #17
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Indirect returning #REF! to cell reference

    Quote Originally Posted by AliGW View Post
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, 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.
    Already done. Again, thank you for the reminder. On both accounts.

  18. #18
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Indirect returning #REF! to cell reference

    Quote Originally Posted by TMS View Post
    @CWatsonJr: You're welcome. Thanks for the rep.
    You are very welcome and THANK YOU!

+ 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. Stop INDIRECT function returning a 0 if cell is blank?
    By Belinea2010 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-03-2021, 10:39 AM
  2. 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
  3. Replies: 4
    Last Post: 12-28-2014, 02:43 PM
  4. [SOLVED] =INDIRECT, Sheet reference with Incremental cell reference
    By Deap in forum Excel General
    Replies: 4
    Last Post: 06-16-2014, 05:58 AM
  5. [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
  6. [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
  7. Reference Indirect cell in VBA
    By BrendanJenman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-18-2005, 12:09 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