Named Ranges do not Sort

Jtucker10278

Board Regular
Joined
May 14, 2017
Messages
62
Office Version
  1. 365
Platform
  1. Windows
So Oh Holy ____!

I wish i would have known this 75 hours ago when i started making this beast of workbook


I have a list of 75 names in Column A

and for each name there is a named range for that row[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Wk1[/TD]
[TD]Wk2[/TD]
[TD]Wk3[/TD]
[TD]Wk4[/TD]
[TD]Wk5[/TD]
[TD]Wk6
[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]John[/TD]
[TD]10[/TD]
[TD]12[/TD]
[TD]9[/TD]
[TD]13[/TD]
[TD]15[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]James[/TD]
[TD]6[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]8[/TD]
[TD]4[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]David[/TD]
[TD]9[/TD]
[TD]8[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD]9[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Lamont[/TD]
[TD]3[/TD]
[TD]2[/TD]
[TD]6[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Dustin[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]2[/TD]
[TD]4[/TD]
[TD]8[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Dan[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]6[/TD]
[TD]4[/TD]
[TD]8[/TD]
[TD]7[/TD]
[/TR]
</tbody>[/TABLE]

B2:G2 = John (named range)
B3:G3 = James (named range)

ect ect ect

Now lets say I want/need to sort the names (and their respective date) alphabetically.

The names Sort, The data sorts, but the named ranges do not sort.

Any thoughts?

Thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I think you're painting yourself into a corner having a different range name for each person.

I'd have a single data range name: MyData:=B2:G7

Then you can do things like this:

C10: =IFERROR(MIN(INDEX(MyData,MATCH(B10,A2:A7,),)),"n/a")
D10: =IFERROR(MAX(INDEX(MyData,MATCH(B10,A2:A7,),)),"n/a")


Excel 2010
ABCDEFG
1Wk1Wk2Wk3Wk4Wk5Wk6
2John1012913157
3James657842
4David986798
5Lamont326235
6Dustin152485
7Dan126487
8
9Min SaleMax Sale
10David69
Sheet1
 
Last edited:
Upvote 0
So my original post was a bit over simplified (see below)

in addition to my names being named ranges i also have my weeks set as name ranges so i can do intersection sums via the indirect function

=IFERROR(SUM(INDIRECT(C$3) INDIRECT($B10)),"") with this formula i can copy and paste it into all 75 names and 52 weeks and im all set

I did figure out that i can manualy adjust the rows and the named ranges will follow suit. all i really need it for is to add new names in order down the road


Book1
BCDEFGHIJKLMNOPQRST
3Week_1Week_2Week_3
4MonTueWedThuFriSatMonTueWedThuFriSatMonTueWedThuFriSat
51234568910111213151617181920
6
7HOURS8888888888888886
8ASM_COUNT11111081001081010101109109105
9TOTAL4458433755056346556674705756486333
10
11OTHER111
12A_Sanchez43116245773871411
13A_Holmes11512112811319911
14B_Perez21172434369197118
15C_Reynolds3147586361151412
16M_Lopez136831317126434
17M_Reynolds611456411129114592
18M_Tran37361244111112124466
19N_Fonseca129715951112812376
20S_Hernandez06611121191298459967
21T_Stohler1143141323455114
Input Table



as a side note I really wish i would have taken the time to figure out that HTML Maker a long time ago, that makes life super easy[h=2][/h]
 
Upvote 0
You can use an Index/Match approach to look up both row and column. Here's one way you could do this without using multiple range names (and the volatile Indirect function).

MyData: C12:O15
Names: B12:B15
B20: =SUMPRODUCT(INDEX(MyData,MATCH(B18,Names,),)*(COLUMN(MyData)>=MATCH(B19,3:3,))*(COLUMN(MyData)<6+MATCH(B19,3:3,)))

Or you could just use a pivot table.


Excel 2010
BCDEFGHIJKLMNO
3Week_1Week_2Week_3
4MonTueWedThuFriSatMonTueWedThuFriSatMon
5123456891011121315
6
7HOURS88888888888
8ASM_COUNT1111108100108101010110
9TOTAL445843375505634655667470
10
11OTHER111
12A_Sanchez43116245773
13A_Holmes115121128113
14B_Perez21172434369
15C_Reynolds31475863611
16
17
18A_Sanchez
19Week_2
2025
Sheet1
 
Last edited:
Upvote 0
So I have several comments/questions

1. Why does everyone seem to frown on INDIRECT function? What are its issues? it has served me well so far, but that word volatile makes me think at some point Ill regret having used it.

2. Repeat paste formulas. My input sheet is set up with (col) 52 "Week_#" NamedRange, and (row) 75 "names" NamedRange.
Then In four other Results tables
Totals By Week =IFERROR(SUM(INDIRECT(C$3) INDIRECT($B10)),"")
Daily Avg By Week =IFERROR(AVERAGE(INDIRECT(C$3) INDIRECT($B10)),"")
Hourly Avg By Week =IFERROR(Wk_Totals!C10/SUMPRODUCT((INDIRECT(Wk_Hour_Avg!C$3) Hours)*((INDIRECT(Wk_Hour_Avg!C$3) INDIRECT(Wk_Hour_Avg!$B10))<>"")),"")
% of total by Week =IFERROR(SUM(Wk_Totals!C10/Wk_Totals!C$7),"")

The benefit to all of these formulas are that i can paste them in all 3900 cells (52col by 75row) and they work

The most important part of using the INDIRECT function is that I understand it and know how to use it. Which brings me to my last question

3. Sumproduct. I understand sumproduct's intended use of "Summing Products" but the hidden mystery use of magically looking things up and cross referencing I am lost. further more I can find anything that explains how its secondary use works. (at least not in a way i understand) And I am by no means a novice with excel (I'm not a wizard) but I would love to figure it out if you know of any reference material that could help me
 
Upvote 0
1. INDIRECT is a volatile function, which means that it recalculates every time Excel recalculates. So you may find that with 3,900 cells updating every time Excel recalculates, your workbook is a bit sluggish. If it's performing OK, I wouldn't stress too much about using volatile functions. More info: http://www.decisionmodels.com/calcsecretsi.htm

2. The nice thing about Excel is that you can do things many different ways. There's nothing wrong with your approach, although you have identified a couple of drawbacks, e.g. having to maintains multiple range names, and the sort issue identified in the original post. A pivot table would be a possible alternative. My formula approach, with one range name is another. There may be smarter alternatives.

3. Check out these two articles on the Sumproduct and Index functions:

http://www.excelhero.com/blog/2010/01/the-venerable-sumproduct.html
http://www.excelhero.com/blog/2011/03/the-imposing-index.html

In terms of Excel resources generally, forum member, hiker95, has assembled this list (see Post#2)

https://www.mrexcel.com/forum/lounge-v-2-0/1031751-two-novice-questions.html
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top