Content of a cell as column in formula?

unclefish

New Member
Joined
Jun 8, 2023
Messages
7
Office Version
  1. 2019
Platform
  1. Windows
Dear Excelists,
I'd appreciate your help with the following problem:
I have an Excel worksheet with some numbers in columns E and F (see the screenshot).
In my cell B2, I would like to calculate the sum of the numbers in one of the two columns. I indicate the relevant column in cell B1 (in this example I selected column E)

Capture.JPG

How do i modify the default SUM formula, so that it looks up cell B1 and uses the content of this cell as column in the formula?

Thanks for your help!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Here is one way:
Excel Formula:
=SUM(INDIRECT(B1 & "1:" & B1 & "5"))
 
Upvote 0
Solution
A possibility depending on eventual other requirements
Excel Formula:
=SUM(INDEX(E1:F5,,CODE(C1)-100))
 
Upvote 0
Thanks Joe4, this is exactly what i needed!
Thanks arthurbr for your comment too!
 
Upvote 0
You are welcome.
Glad we were able to help!
 
Upvote 0

Forum statistics

Threads
1,215,093
Messages
6,123,069
Members
449,090
Latest member
fragment

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