I think I understand what you are saying & yes, that should work. My thought was to add 1 to a column for everyday that the SOH was zero & then have a total of all the days that SOH for the item is zero which would then be subtracted from DATEDIF(Sart Date, Todays Date, "D") to give the total of actual days with a SOH>0.
The actual SOH is calculated by SUM(Units Received-Units Dispensed-Units Expired-Units Transferred). The totals for each of these transactions are progressive totals, irrespective of date, & is done using a macro which was very kindly written for me by one of the Mr Excel administrators. I can send you the code if that would help.
Here's what what part of the spreadsheet looks like.
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; text-align: center; font: 12.0px Calibri}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Calibri}span.s1 {text-decoration: line-through}table.t1 {border-collapse: collapse}td.td1 {background-color:
#33cccc ; border-style: solid; border-width: 0.8px 0.8px 0.8px 0.8px; border-color:
#000000 #000000 #000000 #000000 ; padding: 0.0px 5.0px 0.0px 5.0px}td.td2 {background-color:
#99ccff ; border-style: solid; border-width: 1.0px 0.8px 1.0px 0.8px; border-color:
#bfbfbf #000000 #bfbfbf #000000 ; padding: 0.0px 5.0px 0.0px 5.0px}td.td3 {background-color:
#33cccc ; border-style: solid; border-width: 1.0px 0.8px 0.8px 0.8px; border-color:
#bfbfbf #000000 #000000 #000000 ; padding: 0.0px 5.0px 0.0px 5.0px}td.td4 {border-style: solid; border-width: 0.8px 0.8px 0.8px 0.8px; border-color:
#000000 #000000 #000000 #000000 ; padding: 0.0px 5.0px 0.0px 5.0px}td.td5 {border-style: solid; border-width: 0.8px 1.0px 0.8px 0.8px; border-color:
#000000 #bfbfbf #000000 #000000 ; padding: 0.0px 5.0px 0.0px 5.0px}td.td6 {background-color:
#ff00ff ; border-style: solid; border-width: 0.8px 0.8px 0.8px 0.8px; border-color:
#000000 #000000 #000000 #000000 ; padding: 0.0px 5.0px 0.0px 5.0px}td.td7 {background-color:
#00ff00 ; border-style: solid; border-width: 0.8px 0.8px 0.8px 1.0px; border-color:
#000000 #000000 #000000 #bfbfbf ; padding: 0.0px 5.0px 0.0px 5.0px}td.td8 {background-color:
#ffffff ; border-style: solid; border-width: 0.8px 0.8px 0.8px 1.0px; border-color:
#000000 #000000 #000000 #bfbfbf ; padding: 0.0px 5.0px 0.0px 5.0px}</style>[TABLE="class: t1"]
<tbody>[TR]
[TD="class: td1"]
DESCRIPTION - Generic Name of Medication
[/TD]
[TD="class: td1"]
UNITS
[/TD]
[TD="class: td2"]
Expire date
[/TD]
[TD="class: td3"]
TOTAL SOH QTY
[/TD]
[TD="class: td3"]
REORDER LEVEL
[/TD]
[TD="class: td3"]
RECEIPTS
[/TD]
[TD="class: td3"]
ISSUES
[/TD]
[TD="class: td1"]
TRANSFERS
[/TD]
[/TR]
[TR]
[TD="class: td4"]Acyclovir Cream 5% 2g
[/TD]
[TD="class: td5"]Per Tube
[/TD]
[TD="class: td6"]Dec-19
[/TD]
[TD="class: td7"]
-1
[/TD]
[TD="class: td4"]14
[/TD]
[TD="class: td8"]165
[/TD]
[TD="class: td8"]152
[/TD]
[TD="class: td8"]19
[/TD]
[/TR]
[TR]
[TD="class: td4"]Acyclovir Eye Ointment 3% 4.5g
[/TD]
[TD="class: td5"]Per Tube
[/TD]
[TD="class: td6"]May-20
[/TD]
[TD="class: td7"]
0
[/TD]
[TD="class: td4"]16
[/TD]
[TD="class: td8"]200
[/TD]
[TD="class: td8"]197
[/TD]
[TD="class: td8"]5
[/TD]
[/TR]
[TR]
[TD="class: td4"]Adrenaline autoInjector 300mcg
[/TD]
[TD="class: td5"]Per PFS
[/TD]
[TD="class: td6"]Nov-19
[/TD]
[TD="class: td7"]
6
[/TD]
[TD="class: td4"]8
[/TD]
[TD="class: td8"]100
[/TD]
[TD="class: td8"]91
[/TD]
[TD="class: td8"]5
[/TD]
[/TR]
[TR]
[TD="class: td4"]Adrenaline Injection 0.1% 1ml (1:1000)
[/TD]
[TD="class: td5"]Per Vial
[/TD]
[TD="class: td6"]
Aug-19
[/TD]
[TD="class: td7"]
1
[/TD]
[TD="class: td4"]10
[/TD]
[TD="class: td8"]130
[/TD]
[TD="class: td8"]126
[/TD]
[TD="class: td8"]5
[/TD]
[/TR]
</tbody>[/TABLE]
I wish I did know more VBA but its so foreign to me. I'm just a dumbass pharmacist!
I hope this makes sense.
Thank you very much for taking the time to look into this for me.