Setting a formula to use a "column" set in a cell

jack109

Board Regular
Joined
May 10, 2020
Messages
63
Office Version
  1. 365
Platform
  1. Windows
Hi

Is there a way to reference a column to be used by using a cell.

For example if G is in B2, then G used in the formula

eg. =SUM(G2:G12)

If B2's value was P then the formula would change to =SUM(P2:P12)

I've tried searching online but I'm finding it hard to word it without providing the above example

Cheers
 
Sorry, typo. Yes. I meant INDIRECT, not INDEX.

You don't need a helper column - you just have your parentheses in the wrong place (if you had used the method of first building the range address, you should have gotten it right), i.e.
Excel Formula:
=IF(INDIRECT(B2&ROW())=100,"yes","no")
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Sorry, typo. Yes. I meant INDIRECT, not INDEX.

You don't need a helper column - you just have your parentheses in the wrong place (if you had used the method of first building the range address, you should have gotten it right), i.e.
Excel Formula:
=IF(INDIRECT(B2&ROW())=100,"yes","no")
Thank you for the assistance and PATIENCE lol , much appreciated!!!
 
Upvote 0
You are welcome.

Remember, first build the formula that returns the range address looking exactly the way you want it.
Then, wrap that whole expression (and just that expression) in INDIRECT(...)
Then, you can build other formulas around that.
 
Upvote 0

Forum statistics

Threads
1,226,466
Messages
6,191,195
Members
453,646
Latest member
SteenP

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