+ Reply to Thread
Results 1 to 12 of 12

How do I make a named cell look to an address from a formula?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-17-2010
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    127

    How do I make a named cell look to an address from a formula?

    There is some basic principle that I am not really grasping about named cells.

    I get cell addresses in many ways for instance:

    =ADDRESS(AGGREGATE(14, 6, ROW(C$3:C2000)/(C$3:C2000<>""), 1),COLUMN(C1))
    This instance returns the last non blank cell address in Col C.

    Wrap it in a INDIRECT and it will return the cell value.

    So how the hell do i make a NAME so i can use in say =SUM(C1:NAME)
    ?

    It would be great if you could elaborate on why and how because to me at least it seems the names take references slightly differently than regular formulas (If i just threw a concatenation formula takes the reference and works)

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: How do I make a named cell look to an address from a formula?

    Hi.

    Firstly, I trust that the data in that column contains null strings ("") as a result of formulas in those cells? Otherwise there are far more efficient set-ups for determining the last non-blank row.

    If you define e.g. LRow in Name Manager as:

    =INDEX($C:$C,AGGREGATE(14,6,ROW($C$3:$C2000)/($C$3:$C2000<>""),1))

    then:

    =SUM(C1:LRow)

    will be a perfectly valid syntax.

    However, I have taken the liberty to make absolute the reference to column C in this definition. I'm not sure where you intend to use any formulas which reference LRow, though of course I'm sure you're aware that formulas in Defined Names behave in precisely the same way as those within the worksheet, i.e. they take into account relative/absolute referencing.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Contributor
    Join Date
    08-17-2010
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    127

    Re: How do I make a named cell look to an address from a formula?

    Quote Originally Posted by XOR LX View Post
    Hi.
    ...
    Whats the catch here?
    If used in a cell the following returns the same thing as your index variant:

    =INDIRECT(ADDRESS(AGGREGATE(14, 6, ROW('QV3'!C$3:C2000)/('QV3'!C$3:C2000<>""), 1),COLUMN(C1)))

    Why does the index work but not this?

    As for the last cell solution, when i was searching for it, some of them broke down on empty cells this is the first one i got that performed.
    What do you suggest if i got blank cells in the range and NOT formulas ending resulting in ""?

    And I take it index is the only way to convert an address for the name so it would use it?
    Last edited by Polymorpher; 12-23-2015 at 08:33 AM.

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: How do I make a named cell look to an address from a formula?

    Quote Originally Posted by Polymorpher View Post
    Whats the catch here?
    If used in a cell the following returns the same thing as your index variant:

    =INDIRECT(ADDRESS(AGGREGATE(14, 6, ROW('QV3'!C$3:C2000)/('QV3'!C$3:C2000<>""), 1),COLUMN(C1)))

    Why does the index work but not this?
    ADDRESS returns a text string which merely looks like a range reference. Using INDIRECT won't help since that then returns the actual cell contents. INDEX, however, is capable of returning an actual range reference (as well as a cell content, depending on how the function is employed).

    Quote Originally Posted by Polymorpher View Post
    As for the last cell solution, when i was searching for it, some of them broke down on empty cells this is the first one i got that performed.
    What do you suggest if i got blank cells in the range and NOT formulas ending resulting in ""?
    That would be dependent upon whether the entries in that range were purely text, purely numeric or a mixture of both datatypes.

    Quote Originally Posted by Polymorpher View Post
    And I take it index is the only way to convert an address for the name so it would use it?
    See above. In any case, INDEX set-ups are far better in general than ADDRESS/INDIRECT ones, not least since they lack the volatility of the latter.

    Regards

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

    Re: How do I make a named cell look to an address from a formula?

    INDIRECT does return a range object.

    And your original formula works just fine as a named range with Indirect, then using
    =SUM(C1:NamedRange) works as well.

    Example
    indirect(address.xlsx

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: How do I make a named cell look to an address from a formula?

    Apologies. I stand corrected.

    Still prefer INDEX for volatility reasons, however.

    Regards

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

    Re: How do I make a named cell look to an address from a formula?

    Quote Originally Posted by XOR LX View Post
    Still prefer INDEX for volatility reasons, however.
    I completely agree, there are far more efficient methods of finding the last occupied row.

    @Polymorpher
    If the intent is to SUM the values in C, then we merely need to find the last Numeric Value in the column.
    Try this as your named range instead.

    =INDEX($C:$C,MATCH(9.99999999999999E+307,$C:$C))

    Then
    =SUM(C1:NamedRange)

  8. #8
    Forum Contributor
    Join Date
    08-17-2010
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    127

    Re: How do I make a named cell look to an address from a formula?

    Thank you both

  9. #9
    Forum Contributor
    Join Date
    08-17-2010
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    127

    Re: How do I make a named cell look to an address from a formula?

    My bad for misleading you folks its not working, i apparently messed up something when setting it up.

    The data mix keeps changing in type and composition. I've used match index before for that but i guess its habitual. Its easier to wrap/unwrap the address in INDIRECT( enter (autocorrect, done), than wrap index match in a cell("address",


    Its also a flexible beast. Its a fast tweak to find matches 2 positions before the last etc. It always works regardless of data and spaces, i guess thats why i stuck to it as a powerhouse
    Last edited by Polymorpher; 12-23-2015 at 10:50 AM.

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

    Re: How do I make a named cell look to an address from a formula?

    If the datatype in the range could be either number or text or both, then try

    Named Ranges:
    LNum: =IFERROR(MATCH(9.99999999999999E+307,Sheet1!$C:$C),"")
    LText: =IFERROR(MATCH(REPT("z",255),Sheet1!$C:$C),"")
    LCell: =INDEX(Sheet1!$C:$C,MAX(LNum,LText))

    Then use
    =SUM(C1:LCell)

  11. #11
    Forum Contributor
    Join Date
    08-17-2010
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    127

    Re: How do I make a named cell look to an address from a formula?

    Sure, whats the benefit to replacing what i got now? (might be a noob question but still)

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

    Re: How do I make a named cell look to an address from a formula?

    Quote Originally Posted by Polymorpher View Post
    whats the benefit
    Efficiency.

    Indirect is a volatile function, meaning it recalculates every single time Anything in the book changes, regardless if that change is relevant to that function or not.

    Plus, the binary search used by the MATCH function is leaps and bounds faster than AGGREGATE(14, 6, ROW('QV3'!C$3:C2000)/('QV3'!C$3:C2000<>""), 1)
    And I mean really fast, like comparing a Turtle to a Cheetah faster.
    Last edited by Jonmo1; 12-23-2015 at 12:23 PM.

+ 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. Non-Volatile Alternative: Cell or Indirect and Address for Named Range Formula
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-07-2015, 10:02 AM
  2. I Want to know how I can make this formula into vba code for dynamic cell address
    By dgdgdg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2013, 02:41 PM
  3. [SOLVED] I Want to know how I can make this formula into vba code for dynamic cell address
    By dgdgdg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2013, 12:54 PM
  4. [SOLVED] Use address of named range to find same address in another worksheet
    By dwsteyl in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-08-2013, 04:56 PM
  5. [SOLVED] Use ISBLANK Function with Named Range Instead of Cell Address
    By Toner in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 05-11-2012, 02:33 PM
  6. Replies: 1
    Last Post: 09-28-2005, 04:05 PM
  7. Replace a spreadsheets named cells/ranges with exact cell address!
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-16-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