# Need formula

#### punit83

##### New Member
Hello,

I am looking for a formula, which can help me to calculate my cost of the goods at time of selling.
Attachment is for refrence.

just for info
a) in coloumn j4 unit of my 1st purchase are sold out and by balance unit is 0, so in coloumn j5 i want to take new cost from the date of purchase from 09/03/21.
b) in coloumn j9 cost of 3 units is average from 28/04/21 (2 @ 673.017) to 12/05/21 (1 @ 676.676)

Hope i could make understand my query with given example.

Need Formula.xlsx
ABCDEFGHIJK
1#DateStatusScrip NameQtyRateAmount C.O.G/UnitCost of Goods TotalDifference
10Total80-1,560.640.00-1,560.64
Sheet 1
Cell Formulas
RangeFormula
J3:J4,J8:J9,J6J3=[@[C.O.G/Unit]]*[@Qty]
K2:K9K2=[@[Cost of Goods Total]]-[@Amount]
J10J10=SUBTOTAL(109,[Cost of Goods Total])
K10K10=SUBTOTAL(109,[Difference])
A2:A9A2=ROW(A1)
C10C10=SUBTOTAL(103,[Status])
E10E10=SUBTOTAL(109,[Qty])
F10F10=IFERROR(Cs.Transaction27[[#Totals],[Amount]]/Cs.Transaction27[[#Totals],[Qty]],"-")
G10G10=SUBTOTAL(109,[Amount])

### Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Replies
0
Views
108
Replies
0
Views
289
Replies
2
Views
183
Replies
3
Views
129
Replies
2
Views
335

1,203,620
Messages
6,056,327
Members
444,861
Latest member
B4you_Andrea

### 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.

### Which adblocker are you using?

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

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