Build formula based off value in another Cell

PeterWilson80

New Member
Joined
Oct 14, 2019
Messages
2
I am trying to get a formula to build based off a row reference i put into another

I have tried to put a simplified example of what i mean below

E2 is calculated using the formula shown in F2 as an example

So i have 4 columns of data, A - D, and i want to, for the example, minus the fig in D2 from A2, but what i want to do is have the Column Letter pulled from the Cells E1 & F1, so if i changed those entries it changes the formula, so if i wanted to minus the fig in B2 from A2 i would change the D in cell F1 to a B.

Not sure if this is possible or how to do it.[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]A[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]10[/TD]
[TD]2[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]5[/TD]
[TD]=A2-D2[/TD]
[/TR]
</tbody>[/TABLE]







 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You could use =INDIRECT(E1&"2")-INDIRECT("F1"&2)

Which is volatile, or you could use
=INDEX($A2:$D2,1, Match(E1,{"A","B","C","D"},0)) - INDEX($A$2:$D2, 1, FIND(F1,"ABCD"))
which is non volatile and uses two different methods of finding the column reference.
 
Last edited:
Upvote 0
Hi & welcome to MrExcel.
How abot
=INDIRECT($E$1&ROW(A2))-INDIRECT($F$1&ROW(A2))
 
Upvote 0
I managed to get your example of =INDIRECT(E1&"2")-INDIRECT("F1"&2) and adjust it to what i required.

Thank you to both for the amazingly fast responses. Incredible

:)
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,025
Members
452,542
Latest member
Bricklin

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