Home

Using Values in a Named Range as Sheet References in a Formula

%3CLINGO-SUB%20id%3D%22lingo-sub-868777%22%20slang%3D%22en-US%22%3EUsing%20Values%20in%20a%20Named%20Range%20as%20Sheet%20References%20in%20a%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-868777%22%20slang%3D%22en-US%22%3E%3CP%3EHey%20all%20-%20Bit%20of%20an%20odd%20one%20here%2C%20and%20the%20answer%20may%20require%20some%20VB%20coding%2C%20but%20thought%20I%20would%20start%20here.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20am%20building%20a%20spreadsheet%20to%20keep%20track%20of%20data%20for%20members%20of%20a%20club.%20Each%20member%20has%20their%20own%20worksheet%20form%20where%20we%20track%20data%20on%20a%20week-by-week%20basis.%20Weekly%2C%20monthly%2C%20quarterly%2C%20and%20annual%20summaries%20are%20also%20reported%20on.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EI%20have%20all%20of%20the%20formulas%20in%20place%2C%20and%20it%20works%20as%20I%20want%20to%20for%20now%2C%20but%20the%20sticking%20point%20is%20this%3A%20We%20face%20a%20constantly%20changing%20group%2C%20where%20new%20people%20come%20in%2C%20current%20people%20leave%2C%20etc.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20created%20a%20dynamic%20named%20range%20on%20one%20sheet%20to%20keep%20track%20of%20the%20members%2C%20and%20that%20solves%20some%20of%20my%20calculation%20issues.%20What%20I%20would%26nbsp%3B%3CEM%3Elike%3C%2FEM%3E%20to%20do%20is%20use%20the%20values%20in%20the%20named%20range%20as%20sheet%20references%20in%20formulas%2C%20because%20we%20calculate%20things%20like%20who%20did%20the%20best%20at%20X%2C%20Y%2C%20and%20Z%20each%20week%20%2F%20month%20%2F%20quarter%20%2F%20year.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EHere's%20an%20example%3A%26nbsp%3B%20For%20formula%20purposes%2C%20my%20named%20range%20looks%20like%20this%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EBOB%3C%2FP%3E%3CP%3EJIM%3C%2FP%3E%3CP%3ESAM%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEach%20of%20these%20people%20has%20their%20own%20worksheets%2C%20which%20I%20have%20also%20named%20BOB%2C%20JIM%2C%20and%20SAM.%3CBR%20%2F%3E%3CBR%20%2F%3EWhen%20I%20do%20a%20calculation%2C%20I%20can%20use%20the%20BOB%3ASAM%20range%20to%20tell%20Excel%20to%20reference%20the%20same%20cells%20across%20different%20sheets.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%2C%20now%20Pete%20decides%20to%20join%20the%20group%2C%20so%20my%20dynamic%20named%20range%20now%20looks%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBOB%3C%2FP%3E%3CP%3EJIM%3C%2FP%3E%3CP%3ESAM%3C%2FP%3E%3CP%3EPETE%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20Pete%20joins%20the%20group%2C%20I%20also%20have%20to%20add%20PETE%20as%20a%20worksheet%2C%20which%20means%20I%20also%20have%20to%20manually%20modify%20many%20of%20my%20formulas%20to%20now%20use%20the%20range%20BOB%3APETE.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo...%20Is%20there%20a%20way%20for%20me%20to%20take%20a%20formula%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(%24A%243%26gt%3B%3DB31%2CMIN('BOB%3APETE'!J38)%2C%22%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eand%20replace%20the%20'BOB%3APETE%22%20with%20a%20named%20range%2C%20so%20Excel%20knows%20to%20check%20across%20worksheets%20named%20like%20the%20entries%20in%20my%20dynamic%20named%20range%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-868777%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-868825%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Values%20in%20a%20Named%20Range%20as%20Sheet%20References%20in%20a%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-868825%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412966%22%20target%3D%22_blank%22%3E%40ArchieGoodwin%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20idea%20is%20here%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fexceljet.net%2Fformula%2F3d-sumif-for-multiple-worksheets%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fexceljet.net%2Fformula%2F3d-sumif-for-multiple-worksheets%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EFor%20such%20data%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20212px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F132918i4D80063053A176B8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eformula%20in%20C4%20(to%20take%20average)%20is%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DSUMPRODUCT(%0A%20%20AVERAGE(%0A%20%20%20%20INDIRECT(%22'%22%20%26amp%3B%0A%20%20%20%20%20%20%20%24B%244%3AINDEX(%24B%244%3A%24B%2450%2CCOUNTA(%24B%244%3A%24B%2450))%20%26amp%3B%0A%20%20%20%20%20%20%20%22'!%22%20%26amp%3B%0A%20%20%20%20%20%20%20ADDRESS(ROW(A1)%2CCOLUMN(A1))%0A%20%20%20%20)%0A%20%20)%0A)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EYou%20have%20list%20of%20your%20sheets%2C%20use%20dynamic%20range%20formula%20to%20return%20it%2C%20substitute%20to%20INDIRECT.%20Not%20to%20hardcode%20cell%20reference%20like%20%22A1%22%20we%20use%20ADDRESS.%20Combine%20and%20wrap%20by%20INDIRECT.%20Apply%20our%20function%2C%20AVERAGE%2C%20to%20it.%20Since%20formula%20doesn't%20work%20with%203D%20array%20directly%2C%20we%20wrap%20all%20together%20by%20SUMPRODUCT.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-869197%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Values%20in%20a%20Named%20Range%20as%20Sheet%20References%20in%20a%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-869197%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412966%22%20target%3D%22_blank%22%3E%40ArchieGoodwin%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20just%20picks%20up%20on%20one%20aspect%20of%20your%20problem%2C%20namely%20adding%20sheets%20to%20a%203D%20range.%26nbsp%3B%20The%20'normal'%20process%20is%20to%20'top%20and%20tail'%20your%20member%20sheets%20with%20further%20blank%20sheets%20MEMBERS%20and%20END.%26nbsp%3B%20Provided%20the%20formulas%20can%20cope%20with%20blank%20cells%2C%20they%20may%20be%20applied%20to%20the%203D%20range%20MEMBERS%3AEND.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnother%20function%20that%20can%20be%20useful%20is%20CHOOSE%20which%20will%20'glue'%20together%20named%20ranges%20(here%20columns%20N)%3C%2FP%3E%3CP%3E%3CFONT%3E%3D%20CHOOSE(%7B1%2C2%7D%2C%20Sheet1!N%2C%20Sheet2!N%20)%3C%2FFONT%3E%3C%2FP%3E%3CP%3Eto%20form%20a%202D%20array%20that%20may%20then%20be%20used%20in%20formulas%20such%20as%3C%2FP%3E%3CP%3E%3CFONT%3E%3D%20MMULT(%20array%2C%20%7B3%3B1%7D%20)%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-869208%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Values%20in%20a%20Named%20Range%20as%20Sheet%20References%20in%20a%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-869208%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPeter%2C%20from%20my%20point%20of%20view%20Start%3AEnd%20approach%20is%20not%20reliable%20if%20sheets%20are%20added%2Fremoved%20quite%20often.%20Probability%20that%20next%20BOB%20appears%20after%20END%20is%20quite%20high.%20Plus%20addition%20efforts%20to%20work%20with%20formulas%20to%20exclude%20zeros%20(or%20pre-defined%20values)%20in%20Start%20and%20End.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-869364%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Values%20in%20a%20Named%20Range%20as%20Sheet%20References%20in%20a%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-869364%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Sergei%3C%2FP%3E%3CP%3EI%20wasn't%20claiming%20it%20was%20robust!%26nbsp%3B%20It%20was%20just%20a%20way%20of%20ensuring%20that%20the%20sheets%20could%20be%20inserted%20without%20needing%20to%20play%20'hunt%20the%20reference'.%26nbsp%3B%20I%20agree%20that%20robust%20is%20better%20but%20it%20almost%20runs%20counter%20to%20the%20'Wild%20West'%20spirit%20in%20which%20almost%20all%20spreadsheets%20are%20written.%3C%2FP%3E%3CP%3EPeter%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-877071%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Values%20in%20a%20Named%20Range%20as%20Sheet%20References%20in%20a%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-877071%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20to%20both%20of%20you%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B-%20Something%20for%20me%20to%20work%20with%20now.%20I'll%20try%20both%20methods%2C%20and%20come%20back%20with%20my%20comments%20on%20each.%20Much%20appreciated!%3C%2FP%3E%3C%2FLINGO-BODY%3E
ArchieGoodwin
New Contributor

Hey all - Bit of an odd one here, and the answer may require some VB coding, but thought I would start here.

I am building a spreadsheet to keep track of data for members of a club. Each member has their own worksheet form where we track data on a week-by-week basis. Weekly, monthly, quarterly, and annual summaries are also reported on. 

I have all of the formulas in place, and it works as I want to for now, but the sticking point is this: We face a constantly changing group, where new people come in, current people leave, etc.

 

I have created a dynamic named range on one sheet to keep track of the members, and that solves some of my calculation issues. What I would like to do is use the values in the named range as sheet references in formulas, because we calculate things like who did the best at X, Y, and Z each week / month / quarter / year.

Here's an example:  For formula purposes, my named range looks like this:

BOB

JIM

SAM

 

Each of these people has their own worksheets, which I have also named BOB, JIM, and SAM.

When I do a calculation, I can use the BOB:SAM range to tell Excel to reference the same cells across different sheets.

 

So, now Pete decides to join the group, so my dynamic named range now looks like this:

 

BOB

JIM

SAM

PETE

 

When Pete joins the group, I also have to add PETE as a worksheet, which means I also have to manually modify many of my formulas to now use the range BOB:PETE.

 

So... Is there a way for me to take a formula like this:

 

=IF($A$3>=B31,MIN('BOB:PETE'!J38),"")

 

and replace the 'BOB:PETE" with a named range, so Excel knows to check across worksheets named like the entries in my dynamic named range?

 

Thanks!

5 Replies

@ArchieGoodwin 

The idea is here https://exceljet.net/formula/3d-sumif-for-multiple-worksheets

For such data

image.png

formula in C4 (to take average) is

=SUMPRODUCT(
  AVERAGE(
    INDIRECT("'" &
       $B$4:INDEX($B$4:$B$50,COUNTA($B$4:$B$50)) &
       "'!" &
       ADDRESS(ROW(A1),COLUMN(A1))
    )
  )
)

You have list of your sheets, use dynamic range formula to return it, substitute to INDIRECT. Not to hardcode cell reference like "A1" we use ADDRESS. Combine and wrap by INDIRECT. Apply our function, AVERAGE, to it. Since formula doesn't work with 3D array directly, we wrap all together by SUMPRODUCT.

@ArchieGoodwin 

This just picks up on one aspect of your problem, namely adding sheets to a 3D range.  The 'normal' process is to 'top and tail' your member sheets with further blank sheets MEMBERS and END.  Provided the formulas can cope with blank cells, they may be applied to the 3D range MEMBERS:END.

 

Another function that can be useful is CHOOSE which will 'glue' together named ranges (here columns N)

= CHOOSE({1,2}, Sheet1!N, Sheet2!N )

to form a 2D array that may then be used in formulas such as

= MMULT( array, {3;1} )

@Peter Bartholomew 

Peter, from my point of view Start:End approach is not reliable if sheets are added/removed quite often. Probability that next BOB appears after END is quite high. Plus addition efforts to work with formulas to exclude zeros (or pre-defined values) in Start and End.

@Sergei Baklan 

Hi Sergei

I wasn't claiming it was robust!  It was just a way of ensuring that the sheets could be inserted without needing to play 'hunt the reference'.  I agree that robust is better but it almost runs counter to the 'Wild West' spirit in which almost all spreadsheets are written.

Peter

Thanks to both of you, @Peter Bartholomew @Sergei Baklan - Something for me to work with now. I'll try both methods, and come back with my comments on each. Much appreciated!

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies