accessing a cell that can change from query to query

kenman

Board Regular
Joined
Jan 27, 2005
Messages
85
Hi,
I am working with a spreadsheet that has about ten columns. I would like to have a calculation in the 1st of column, addition, subtraction, etc that would be using the data in 2 or more of the other columns. I am looking to change this data so I am looking to have either a formula in each cell in column "A" that I can change the columns that are in the formula.
For example-I was trying to figure out if there was some way that if I put in cell(1,1) a "3" referencing column 3 and in cell(1,2) say a "5"(refencing column 5). Is there anyway to write a formula in the cells in column 1 that would access the cells in the same row and know which columns I would like to use?
I am trying to do this in VBA, as I'm sure there is an easy way to do it, but I haven't gotten it to work yet.

Thanks for your time and I hope you understand the question.

Ken
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hello, kenman
Welcome to the Board !!!

is this something you could use ?
in A1: 3
in A2: =INDEX(B2:G2,$A$1)
result would be the value in D2, which is the 3th cell of the range B2:G2

although being a real VBA-fan, I don't see why you would do this in VBA
can you clarify a bit if you still want VBA

kind regards,
Erik
 
Upvote 0
thanks

Hi Eric and Mr.Excel

Sorry it's taken so long to get back to you, but I just wanted to say thanks for the help with this. It seems to be just what I needed.


Kenman
 
Upvote 0

Forum statistics

Threads
1,203,140
Messages
6,053,725
Members
444,681
Latest member
Nadzri Hassan

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