Index Function with Multiple Areas

BriargateExcel

New Member
Joined
Apr 13, 2020
Messages
13
Office Version
  1. 365
Platform
  1. Windows
I am trying to use the areas portion of the Index function to select between two different ranges:
=Index((CarRange,TruckRange),1,,$A$1)
CarRange and TruckRange are defined ranges. They resemble: $B$2:$Z$2 and $C$3:$T$3. They are rows of data of different lengths. In my case, CarRange and TruckRange are also dynamic ranges.
I would like to change the value in $A$1 to select between the two ranges

If the Index function is the wrong approach, what is a better way?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
What exactly are you trying to do? I do not fully understand...
 
Upvote 0
I have a graph that uses the range comes from the Index function. I want switch between the Car graph and the Truck graph.
 
Upvote 0
Ok, What are you using as a switch?
 
Upvote 0
The Choose function does it. Here's what I have now:
CarOrTruckRange is a defined name containing:
=Choose($A$1,CarRange,TruckRange)
I use the value in $A$1 to switch between two different ranges.
I use CarOrTruckRange as the Legend axis (the Y axis) in a graph. By changing the value in $A$1, I can switch between displaying the Car values (stored in dynamic range CarRange) and Truck values (stored in dynamic range TruckRange).
Thank you, Eric W! With your guidance, I was able to solve my problem!
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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