Return multiple column headers based on value between two numbers

angie2011

New Member
Joined
Jul 19, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I have been looking for days trying to find how to do this but not having much luck. I am not totally new to writing the complex formulas but haven't used them in a long time (and array has been totally new these last few weeks). I am trying to pull tech names to sheet1 based on the distance they are away from a site (0.01-50 miles, 51-100, 101-150 etc...
I have the table in Mileage! that shows all techs in columns (4), sites in rows (B)
Drop down box is on sheet1 cell B3.
I have been trying to figure out the formula and this is the closest I can come up with
=(INDEX(Mileage!$F$4:$I$4,1,SMALL(IF(INDEX(Mileage!$F$5:$I$13,MATCH($B$3,Mileage!$B$5:$B$13,0),)<=50,COLUMN($A$1:$G$1)),ROW(1:1))))
which is giving me an #N/A, if I play with it enough I will end up with a #value!.
Can anyone help?
I have uploaded my sample sheet.
thank you so much for taking the time to even read and respond.

DROPDOWN IN B3
Site 1
use .01 as low to prevent pulling zero
Techs Available Under 50 MilesTechs Available 50-100 Miles
Tech NameZipCodeMilageTech NameZipCodeMileage
#N/A​

Site_NameSiteOther Info1Other Info2Other Info3Tech 1Tech 2Tech 3Tech 4
20​
Site 1
5​
71​
11​
23​
19​
Site 2
17​
222​
361​
274​
54​
Site 3
9​
148​
16​
34​
2​
Site 4
66​
278​
249​
178​
36​
Site 5
75​
261​
244​
277​
47​
Site 6
99​
351​
111​
139​
52​
Site 7
75​
20​
61​
12​
1​
Site 8
3​
237​
389​
168​
75​
Site 9
21​
300​
62​
92​
 

Attachments

  • Dashboard.png
    Dashboard.png
    16 KB · Views: 9
  • Mileage!.png
    Mileage!.png
    21.8 KB · Views: 8

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi Angie2011,

You have 365 so I'm sure there will be a better solution along but here's my Excel 2016 approach.
NOTE: I couldn't see where the ZipCode came from so I've left that out.

Angie2011.xlsx
ABCDEFGHI
1
2Site Selection
3Site 1
4
5
6
7
8Techs Available Under 50 MilesTechs Available 50-100 Miles
9Tech NameZipCodeMileageTech NameZipCodeMileage
10Tech 15Tech 271
11Tech 311  
12Tech 423  
13  
14Site_NameSiteOther Info1Other Info2Other Info3Tech 1Tech 2Tech 3Tech 4
1520Site 15711123
1619Site 217222361274
1754Site 391481634
182Site 466278249178
1936Site 575261244277
2047Site 699351111139
2152Site 775206112
221Site 83237389168
2375Site 9213006292
Sheet1
Cell Formulas
RangeFormula
D10:D12D10=IFERROR(INDEX($F$15:$I$23,MATCH($B$3,$B$15:$B$23,0),AGGREGATE(15,6,COLUMN($F$14:$I$14)-COLUMN($E$14)/(($F$15:$I$23<50)*($B$15:$B$23=$B$3)),ROW()-ROW($B$9))),"")
H10:H12H10=IFERROR(INDEX($F$15:$I$23,MATCH($B$3,$B$15:$B$23,0),AGGREGATE(15,6,COLUMN($F$14:$I$14)-COLUMN($E$14)/(($F$15:$I$23>=50)*($F$15:$I$23<=100)*($B$15:$B$23=$B$3)),ROW()-ROW($B$9))),"")
B10:B12B10=IFERROR(INDEX($F$14:$I$14,,AGGREGATE(15,6,COLUMN($F$14:$I$14)-COLUMN($E$14)/(($F$15:$I$23<50)*($B$15:$B$23=$B$3)),ROW()-ROW($B$9))),"")
B13B13=IFERROR(INDEX($F$14:$I$14,,AGGREGATE(15,6,COLUMN($F$14:$I$14)-COLUMN($E$14)/(($F$15:$I$23<=50)*($B$15:$B$23=$B$3)),ROW()-ROW($B$9))),"")
F10:F13F10=IFERROR(INDEX($F$14:$I$14,,AGGREGATE(15,6,COLUMN($F$14:$I$14)-COLUMN($E$14)/(($F$15:$I$23>=50)*($F$15:$I$23<=100)*($B$15:$B$23=$B$3)),ROW()-ROW($B$9))),"")
Cells with Data Validation
CellAllowCriteria
B3List=$B$15:$B$23
 
Upvote 0
Solution
Maybe something like this:
Book1
ABCDEFGHI
1Find SiteSite 1
2Less than 5050-100
3Tech 1Tech 2
4Tech 3
5Tech 4
6
7
8
9Site_NameSiteOther Info1Other Info2Other Info3Tech 1Tech 2Tech 3Tech 4
1020Site 15711123
1119Site 217222361274
1254Site 391481634
132Site 466278249178
1436Site 575261244277
1547Site 699351111139
1652Site 775206112
171Site 83237389168
1875Site 9213006292
Sheet1
Cell Formulas
RangeFormula
B3:B5B3=TRANSPOSE(FILTER($F$9:$I$9,INDEX(F10:I18,MATCH($B$1,$B$10:$B$18,0),0)<50,"No Match"))
C3C3=TRANSPOSE(FILTER($F$9:$I$9,(INDEX(F10:I18,MATCH($B$1,$B$10:$B$18,0),0)>=50)*(INDEX(F10:I18,MATCH($B$1,$B$10:$B$18,0),0)<100),"No Match"))
Dynamic array formulas.
 
Upvote 0
For these formulas I get an error saying the filter function is not valid, but the first formula given above does work.
Thank you for your help. I cannot be more grateful.
 
Upvote 0
Hi Angie2011,

You have 365 so I'm sure there will be a better solution along but here's my Excel 2016 approach.
NOTE: I couldn't see where the ZipCode came from so I've left that out.
Toadstool - I cannot thank you enough for the above. I was a little confused with the aggregate function (15,6) but looked it up and was able to make the change in row B9 to move the formula to my actual sheet. This is so amazing!
 
Upvote 0
You're welcome!
Thanks for the feedback.

You already had SMALL so I figured you'd figure AGGREGATE.

Of course if you parameterized the mileage bands it would mean less formulae ;)

Angie2011.xlsx
ABCDEFGHI
1
2Site Selection
3Site 1
4
5
6Between milesBetween miles
7Techs Available050Techs Available 50-100 Miles50100
8Tech NameZipCodeMileageTech NameZipCodeMileage
9Tech 15Tech 271
10Tech 311  
11Tech 423  
12    
13Site_NameSiteOther Info1Other Info2Other Info3Tech 1Tech 2Tech 3Tech 4
1420Site 15711123
1519Site 217222361274
1654Site 391481634
172Site 466278249178
1836Site 575261244277
1947Site 699351111139
2052Site 775206112
211Site 83237389168
2275Site 9213006292
V2
Cell Formulas
RangeFormula
F9:F12,B9:B12B9=IFERROR(INDEX($F$13:$I$13,,AGGREGATE(15,6,COLUMN($F$13:$I$13)-COLUMN($E$13)/(($F$14:$I$22>=C$7)*($F$14:$I$22<=D$7)*($B$14:$B$22=$B$3)),ROW()-ROW($B$8))),"")
H9:H12,D9:D12D9=IFERROR(INDEX($F$14:$I$22,MATCH($B$3,$B$14:$B$22,0),AGGREGATE(15,6,COLUMN($F$13:$I$13)-COLUMN($E$13)/(($F$14:$I$22>=C$7)*($F$14:$I$22<=D$7)*($B$14:$B$22=$B$3)),ROW()-ROW($B$8))),"")
Cells with Data Validation
CellAllowCriteria
B3List=$B$14:$B$22
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,488
Members
448,967
Latest member
visheshkotha

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