Show cell value in formula instead of cell reference

Sufiyan97

Well-known Member
Joined
Apr 12, 2019
Messages
1,538
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Is it possible to show cell value instead of cell reference in a formula? expected results are in column D

Formula (1).xlsx
ABCD
1CompensationExpected
21294.23-52.21346.431346.43
31219.23-52.21271.431271.43
41219.23-52.21271.43
51301.86-52.21354.06
61219.23-52.21271.43
71305.67-52.21357.87
81219.23-53.661272.89
91212.16-53.661265.82
101240.76-53.661294.42
111223.5-53.661277.16
121219.23-53.661272.89
131219.23-53.661272.89
141232.43-53.661286.09
151219.23-53.661272.89
161231.73-53.661285.39
17973.99-53.661027.65
181099.87-53.661153.53
191268.63-53.661322.29
201033.58-53.661087.24
2122953.02903.4622049.56
22
Sheet2
Cell Formulas
RangeFormula
D2D2=1294.23+52.2
D3D3=1219.23+52.2
C2:C21C2=A2-B2


this might help by Fluff

 
Thank you very much Dante, That is it.

Thank you for your time and help.
If the option with macro is accepted, then here is a shorter version.
Similarly change "D" by the letter of the column where you want the result.
VBA Code:
Sub ExpectedResult_1()
  Dim c As Range, s As String
  For Each c In Range("A2", Range("A" & Rows.Count).End(3))
    If c.Offset(, 1).Value < 0 Then s = "+" & -c.Offset(, 1).Value Else s = "-" & c.Offset(, 1).Value
    Range("D" & c.Row).Formula = "=" & c.value & s
  Next
End Sub

or:

VBA Code:
Sub ExpectedResult_3()
  Dim c As Range, s As String
  For Each c In Range("A2", Range("A" & Rows.Count).End(3))
    Range("D" & c.Row).Formula = "=" & c.Value & IIf(c.Offset(, 1).Value < 0, "+" & -c.Offset(, 1).Value, "-" & c.Offset(, 1).Value)
  Next
End Sub
 
Upvote 1

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,215,372
Messages
6,124,531
Members
449,169
Latest member
mm424

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