subtract a existing values with condition Final Cell-First Cell

mmr1

Board Regular
Joined
Aug 25, 2020
Messages
80
Office Version
  1. 365
Platform
  1. Windows
Hi,


Required a formula help to subtract a values existing final cell value F3 & F4 with final cell C3 & C4 values like (F3-C3=Value & F4-C4=value).

Condition here is C3 and C4 values are always same do not have any changes are moving forward but in final cell value F3 and F4 it is not fixed its values are changing like F3 and F4 values not final may be G3 and G4 also add up in future.

And required as a solution would be Final Cell values-First Cell Values=Value.


Thanks,

Book1
ABCDEFGH
1
2
3Expences693940.966954416969413,000.00
4Allowance577504.74583221.8584721.87,217.01
5
6
7
8
9
Sheet2
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
You can Use this Macro:
VBA Code:
Sub FinalCell()
Dim Lcolumn As Long

Lcolumn = Cells(3, Columns.Count).End(xlToLeft).Column
Debug.Print Lcolumn
Range("A3").Value = Cells(3, Lcolumn).Value - Range("C3")
Range("A4").Value = Cells(4, Lcolumn).Value - Range("C4")
End Sub
 
Upvote 0
Or Use this UDF:
VBA Code:
Function FinalCell(row As Range) As Long
Dim Lcolumn As Long
Dim i As Long
Dim y As Long

Lcolumn = Cells(3, Columns.Count).End(xlToLeft).Column

i = row.row

y = Cells(i, Lcolumn).Value - Cells(i, 3).Value
FinalCell = y

End Function
 
Upvote 0
Hi, here's a native formula you could also try.

Excel Formula:
=C3-INDEX(C3:ZZ3,MATCH(9.99999999999999E+307,C3:ZZ3))
 
Upvote 0
Thanks a lot all of you for your various types of solutions.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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