Moving/Scrolling $ fix on row

tannaroo

New Member
Joined
Nov 15, 2022
Messages
13
Office Version
  1. 2019
Platform
  1. Windows
Hi all,
I'm trying to work out a moving cost price per below. My formula in column I works until the the 2 yellow highlighted cells where the cost price should be 50 (orange cell row 10) and 43.33 (orange cell row 11). The reason being it is summing all of the cells whereas it should only sum from the existing row as this is a new share batch (i.e. it should sum all of the purchases to the extent they have been fully sold, in which case it should not fix row 4 but rather fix row 10) - is that possible?

stock purchase example.xlsx
ABCDEFGH
3DateBought/SoldNumberPriceAmount (Base)Cost Price
410-Jun-22B10048.00(4,800.00)48.000
513-Jun-22B10046.00(4,600.00)47.000
614-Jun-22B10045.00(4,500.00)46.333
714-Jul-22B5043.00(2,150.00)45.857
831-Jul-22S(300)40.0012,000.0045.857
905-Aug-22S(50)35.001,750.0045.857
1026-Aug-22B550.00(250.00)45.91550.000
1127-Sep-22B10043.00(4,300.00)45.27543.333
Sheet1
Cell Formulas
RangeFormula
F4:F11F4=ROUND(((-C4 * D4) + E4), 2)
G4:G11G4=-SUMIFS(F$4:F4, B$4:B4, "=B") / SUMIFS(C$4:C4, B$4:B4, "=B")
H10H10=-F10 / C10
H11H11=SUM(F10:F11)/ -SUM(C10:C11)
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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