Access table by column name in a cell, and row number specific ranges

dnaiel

New Member
Joined
Mar 20, 2017
Messages
2
Hi,

I have an excel table named incomeTable like this:

[TABLE="width: 500"]
<tbody>[TR]
[TD]name
[/TD]
[TD]spend
[/TD]
[TD]income
[/TD]
[/TR]
[TR]
[TD]mario
[/TD]
[TD]3
[/TD]
[TD]10
[/TD]
[/TR]
[TR]
[TD]roger
[/TD]
[TD]4
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]tom
[/TD]
[TD]5
[/TD]
[TD]4
[/TD]
[/TR]
</tbody>[/TABLE]

I'd want to access a given column and a given range of rows (but getting the column name from a specific cell).

I.e., Let us say I have in A2 the column name of interest

[TABLE="width: 500"]
<tbody>[TR]
[TD]columnNameOfIInterest
[/TD]
[/TR]
[TR]
[TD]spend
[/TD]
[/TR]
</tbody>[/TABLE]

Then, how would I access a range of rows and all the contents in that column?
=incomeTable[[1:2],[=$A2]]?
(where A2 is spend)

and it'd return
[TABLE="width: 500"]
<tbody>[TR]
[TD]3
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[/TR]
</tbody>[/TABLE]
 
Hi,

If you're looking to SUM those values you could use something like this...

=SUM(INDEX(IncomeTable,1,MATCH(A2,IncomeTable[#Headers],0)):INDEX(IncomeTable,2,MATCH(A2,IncomeTable[#Headers],0)))
 
Upvote 0
Hi Mikey, Thanks. I am not looking to do a sum though, just looking to access a given column and a range of rows. Is that possible using the table format?
 
Upvote 0

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