+ Reply to Thread
Results 1 to 17 of 17

Super cool named ranges with offset.

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

    Super cool named ranges with offset.

    I have named ranges : bd, pl, wh.

    Can anyone make a function that calls up multiple cells from those ranges like so:

    =FUNCTIONNAME(bd3,pl1,wh5)
    That would return the same thing as =INDEX(bd,3)&INDEX(pl,1)&INDEX(wh,5)
    (i can guarantee that the ranges would never have numbers in their names)

    if you need another separator you could use space or "." or "-" or ";" (space would be awesome)

    =FUNCTIONNAME(bd 3,pl 1,wh 5)
    =FUNCTIONNAME(bd.3,pl.1,wh.5)
    =FUNCTIONNAME(bd-3,pl-1,wh-5)
    =FUNCTIONNAME(bd;3,pl;1,wh;5)

    THREAD IS SOLVED with two cool solutions:
    Anyone who uses named ranges could benefit from these.

    EXAMPLE IN ATTACHMENT:
    Attached Files Attached Files
    Last edited by Polymorpher; 08-01-2014 at 09:20 AM. Reason: Solved, proper search name.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Looking for a small tweak on the use of named ranges.

    Create a UDF and pass it the functionname, the range and index values and do it all in VBA. Or are you doing this for a UDF?
    Bernie Deitrick
    Excel MVP 2000-2010

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

    Re: Looking for a small tweak on the use of named ranges.

    Would love to (: Except the only thing i know about VBA its that it stands for Visual Basic ... Something (;

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Looking for a small tweak on the use of named ranges.

    What functions are you looking to use it with?

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

    Re: Looking for a small tweak on the use of named ranges.

    OFFSET, is probably the only thing ill need for it.
    So throwing =OFFSET(cellname,row0,col+1) with =FUNCTIONNAME(bd3,pl1,wh5) returns bd3,pl1 and wh5 offset by 1 column.

    =OFFSET(cellname,row0,col+1) is applied identically to any reference I will make with this so, I don't need to offset bd,3 pl,1 and wh,5 individually with different offsets. I suppose that makes it easier.

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Looking for a small tweak on the use of named ranges.

    Reply with cell addresses:

    What is the range of bd?
    And what cell would be bd3?
    And what cell would =OFFSET(bd3,row0,col+1) be?

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

    Re: Looking for a small tweak on the use of named ranges.

    If bd is A12:A53 then bd3 is the third of that range = A14 (a12 is 1, a13 is 2, a14 is 3)

    Just like in a standard named range and using =INDEX(bd,3)

    OFFSET(BD3,0,1)=B14


    Also if
    pl 1 = A33 and wh 5 = A176

    =FUNCTIONNAME(bd 3,pl 1,wh 5) with that offset would return B14&B33&B176

  8. #8
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Looking for a small tweak on the use of named ranges.

    This UDF will return a range of the indicated cells - put this into a standard codemodule in your workbook:


    Please Login or Register  to view this content.
    You can use it like so:

    =SUM(MyOffset("bd 3","pl 1","wh 5",1))

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

    Re: Looking for a small tweak on the use of named ranges.

    testing that out...
    Last edited by Polymorpher; 07-31-2014 at 05:43 PM.

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

    Re: Looking for a small tweak on the use of named ranges.

    Its an excellent function that: you should leave it unchanged here, no doubt some more people will find it and use it.

    However I'm not calculating anything.

    If the offseted:
    bd 3="Joe "
    pl 1 = "got "
    wh 5 = "a dog"

    doing MyOffset("bd 3","pl 1","wh 5",1)
    should come up with "Joe got a dog."

    or the offsetted:
    bd 3="1"
    pl 1 = "32"
    wh 5 = " dogs chased me."

    doing MyOffset("bd 3","pl 1","wh 5",1)
    should come up with "132 dogs chased me."

    Also I'm willing to sacrifice space as a separator if i can lose the quotation marks and do it MyOffset(bd;3,pl;1,wh;5,1)

    Be sure to post the new function separately so people can use the old one - its pretty neat summing stuff like that.

  11. #11
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Looking for a small tweak on the use of named ranges.

    If you have quotes, we can pass as many in one string as needed:

    =StrOffset("bd 3 pl 1 wh 5",1)
    =StrOffset("bd 3 pl 1 wh 5 bd 12 pl 4 wh 8",1)

    Please Login or Register  to view this content.
    I should probably re-write the first one too to take the same input string style.... nah

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

    Re: Looking for a small tweak on the use of named ranges.

    Its perfect now, one set of quotes is no problem compared to having to quote each of them individually.

    ... About the first one.
    You couldn't handle the additional upstream of karma that would come with rewriting it to go with one set of quotes (: Its just too much for one man (;
    Last edited by Polymorpher; 08-01-2014 at 09:16 AM.

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

    Re: Looking for a small tweak on the use of named ranges.

    Urf da fak, double posted again. Anyway - solved.

  14. #14
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Looking for a small tweak on the use of named ranges.

    Oops - wrong place. I moved the text but I can't delete this message, so sorry.
    Last edited by Bernie Deitrick; 08-01-2014 at 09:34 AM.

  15. #15
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Looking for a small tweak on the use of named ranges.

    =SUM(MyOffset("bd 3 pl 1 wh 5",1))

    Please Login or Register  to view this content.

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

    Re: Super cool named ranges with offset.

    For future reference of people like me stumbling around...

    You can have "bd 3 pl 1 wh 5" in another cell say B5

    and point to it this way

    =StrOffset(B5,1)

    Totally awesome...

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

    Re: Super cool named ranges with offset.

    Also keep in mind that the offset function doesn't seem to refresh content upon changes. You can do that by re-inserting the formula with copy paste.
    Last edited by Polymorpher; 08-02-2014 at 09:25 AM.

+ 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. Define only 2 named ranges from a list of named ranges...
    By abhi900 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-29-2014, 04:20 AM
  2. Looping Mutliple Named Resized Ranges in next empty row below another named range
    By gingumdog in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-19-2014, 08:15 PM
  3. Can someone tweak a small vba code for me?
    By boniouk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-27-2013, 07:35 AM
  4. [SOLVED] Determining if the value of a cell can be a named range, then assigning named ranges after
    By Romulo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-15-2013, 06:05 PM
  5. Replies: 1
    Last Post: 03-21-2006, 06:40 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