+ Reply to Thread
Results 1 to 13 of 13

How to use named range in a formula?

Hybrid View

mstgier How to use named range in a... 01-03-2022, 04:44 AM
AliGW Re: How to use named range in... 01-03-2022, 04:51 AM
mstgier Re: How to use named range in... 01-03-2022, 05:01 AM
Glenn Kennedy Re: How to use named range in... 01-03-2022, 04:51 AM
mstgier Re: How to use named range in... 01-03-2022, 05:08 AM
AliGW Re: How to use named range in... 01-03-2022, 05:02 AM
mstgier Re: How to use named range in... 01-03-2022, 05:06 AM
AliGW Re: How to use named range in... 01-03-2022, 05:04 AM
AliGW Re: How to use named range in... 01-03-2022, 05:06 AM
AliGW Re: How to use named range in... 01-03-2022, 05:10 AM
mstgier Re: How to use named range in... 01-03-2022, 05:12 AM
Glenn Kennedy Re: How to use named range in... 01-03-2022, 05:12 AM
mstgier Re: How to use named range in... 01-03-2022, 05:14 AM
  1. #1
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    How to use named range in a formula?

    Hello Everyone and happy new year,

    I came across "Name range/Define range" and as I understand it, it is a function(?) that can help simplify/shorten formulas.

    In the attached file, I have setup three sheets called Jan, Feb & Mar. In the 4.th sheet called Total, I defined Jan, Feb & Mar as "Months".

    As you can see on Sheet "Total" In Cell B3,

    Jan Sheet.jpg..................Total Sheet.jpg

    I managed to use Index together with Match formula, to receive the Total from Sheet "Jan" with the formula:

    =INDEX(Jan!B:C,MATCH("Total",Jan!B:B,0),2)

    Now I am wondering, if I can replace the reference to the location in the sheets by using the defined range, or is it even possible to use the named range to shorten a formula on such way?

    It would be a "nice to have", to avoid copying the formula and to change every time the month. Maybe it is possible?

    I tried in Cell C4 to modify the formula by replacing the cell-name with:

    "'"&Months&"'!

    and the formula then looks like this:

    =INDEX("'"&Months&"'!B:C",MATCH("Total","'"&Months&"'!B:B",0),2)

    Unfortunately, I end up with an error, so my question is, am I doing something wrong or is it even possible?

    Thank you for any help
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,368

    Re: How to use named range in a formula?

    Yes, you did something wrong!

    There is a way to do what you want with the INDIRECT function, but it doesn't require named ranges:

    =INDEX(INDIRECT("'"&A3&"'!B:C"),MATCH("Total",INDIRECT("'"&A3&"'!B:B"),0),2)
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Re: How to use named range in a formula?

    Thank you so much, you helped me again AliGW
    Last edited by mstgier; 01-03-2022 at 05:03 AM.

  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 2406
    Posts
    44,662

    Re: How to use named range in a formula?

    Yes... and no. For your requirement, you need INDIRECT:

    =INDEX(INDIRECT("'"&A3&"'!C1:C10"),MATCH("Total",INDIRECT("'"&A3&"'!B1:B10"),0))

    Do not use whole column references with INDIRECT. It recalculates EVERY row EVERY time anything changes, so it can cause performance issues.
    Attached Files Attached Files
    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

  5. #5
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Re: How to use named range in a formula?

    Thanx a lot Glenn,
    That did the trick ! I will try to avoid the whole column reference as you explained but what, if the differ in lengths? Shall I just go up to 100 if I am somewhere between 60-80 or what would be a good approach?

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,368

    Re: How to use named range in a formula?

    Which of us are you addressing?

    Your link doesn't work.

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

    Also, if you have not already done so, 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 all those who offered help.

  7. #7
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Re: How to use named range in a formula?

    I am sorry, trying to give you some reputation I get the following:

    You must spread some Reputation around before giving it to AliGW again. ;( Not nice... any other way, I can do so?

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,368

    Re: How to use named range in a formula?

    Thank you so much, you helped me again AliGW
    Administrative Note

    ... please don't ignore contributors to your thread - acknowledge all solutions offered. Thanks.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,368

    Re: How to use named range in a formula?

    It happens ...

    You still haven't acknowledged Glenn's help in this thread.

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

    Re: How to use named range in a formula?

    Just choose a number that exceeeds the maximum length you need.

  11. #11
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Re: How to use named range in a formula?

    I will do so. Thanx again to both of you... anything else I have to do on my side?

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

    Re: How to use named range in a formula?

    Make it entirely future-proof.... 200 will have no significant detrimental effect on performance. A whole column re will calculate >1,000,000 rows. Sio the difference between 100 & 200 is negligible.

  13. #13
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Re: How to use named range in a formula?

    Perfect, will do so, thanx a lot.

+ 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. Replies: 3
    Last Post: 02-09-2021, 03:12 AM
  2. [SOLVED] Named Range formula corruption when deleting information from range
    By JamesT1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-28-2019, 01:59 AM
  3. Listbox displaying named range B but Adding named range A to cell
    By ikkenieikke in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-05-2018, 02:27 PM
  4. Replies: 0
    Last Post: 03-08-2016, 02:25 PM
  5. [SOLVED] Compare cells to named range and create new sheets using related named range
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-10-2015, 03:35 PM
  6. Replies: 1
    Last Post: 02-27-2013, 12:00 AM
  7. [SOLVED] Determine what Named Range the Target Address is and return Named Range Name
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-18-2012, 10:49 PM

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