Forum Discussion
A_SIRAT
Feb 25, 2023Iron Contributor
Formula to Calculate Daily balances
I am struggling to create a stock balances file where I can easily know the closing balances PER DAY, and what I need to borrow from the Main store as explained in the file. I have attached the file...
mtarler
Feb 26, 2023Silver Contributor
so here is the problem, we don't know what data you get/enter.
Since the format isn't fixed I agree with peiyezhu and you should completely reformat it as an entry table and then report tables separately. So for example:
Date . . . . . . . . Store . . . . . Item Code . . . Tx Type . . . Amount
2023-02-26 . . 123. . . . . . . . CHEM1 . . . . . used . . . . . . 400
2023-02-26 . . 123 . . . . . . . CHEM1 . . . . . . add . . . . . . 5000
2023-02-26 . . main . . . . . . CHEM1 . . . . . add . . . . . 100000
this type of ledger style can then be used with pivot tables, power query, or excel formulas to calculate everything assuming you have all the needed entries. But what I'm unclear about is how does the pull from the main get documented? who is to say someone doesn't pull 2 units because they are sick of getting only 1 each time or thought they needed 2 because there was a request for a big amount. And then what about the main? right now you are down to 1 but what if that goes negative (which I assume it can't so how in the sheet is more added to main?)
think of it this way, there are data entry columns and calculated columns and the 2 shall not mix. The 'ledger' style above would all be data entry. Elsewhere would be a reporting table with calculated values. Another table could be all the Item Info like:
Item Code - Item Name - Transfer Size
you could have other info like Min Qty that could be used to have a NEED TO ORDER table/report
That said a formula for N4 (orig sheet) could be: =MAX( 0, ROUNDUP((I4-P3)/5000,0))
so basically if I4 (used) is bigger than what is left (P3) then you need more from store and in increments of 5000 (or whatever reference amt you use) and you round up to cover the amount needed. The MAX( 0, ...) means if the value is negative (i.e. supply > need) then return 0.
Since the format isn't fixed I agree with peiyezhu and you should completely reformat it as an entry table and then report tables separately. So for example:
Date . . . . . . . . Store . . . . . Item Code . . . Tx Type . . . Amount
2023-02-26 . . 123. . . . . . . . CHEM1 . . . . . used . . . . . . 400
2023-02-26 . . 123 . . . . . . . CHEM1 . . . . . . add . . . . . . 5000
2023-02-26 . . main . . . . . . CHEM1 . . . . . add . . . . . 100000
this type of ledger style can then be used with pivot tables, power query, or excel formulas to calculate everything assuming you have all the needed entries. But what I'm unclear about is how does the pull from the main get documented? who is to say someone doesn't pull 2 units because they are sick of getting only 1 each time or thought they needed 2 because there was a request for a big amount. And then what about the main? right now you are down to 1 but what if that goes negative (which I assume it can't so how in the sheet is more added to main?)
think of it this way, there are data entry columns and calculated columns and the 2 shall not mix. The 'ledger' style above would all be data entry. Elsewhere would be a reporting table with calculated values. Another table could be all the Item Info like:
Item Code - Item Name - Transfer Size
you could have other info like Min Qty that could be used to have a NEED TO ORDER table/report
That said a formula for N4 (orig sheet) could be: =MAX( 0, ROUNDUP((I4-P3)/5000,0))
so basically if I4 (used) is bigger than what is left (P3) then you need more from store and in increments of 5000 (or whatever reference amt you use) and you round up to cover the amount needed. The MAX( 0, ...) means if the value is negative (i.e. supply > need) then return 0.
A_SIRAT
Feb 27, 2023Iron Contributor
Thank you.
Let me read and digest this... I will definitely revert.
As for pulling items from Main, there is a control system in place and the issuing store can only get the minimum packaging quantity needed to fill their gap. E.g. if chemical XYZ is delivered by the supplier in 1ltr packaging and the issuing store have a shortage of 2.5ltrs, then they will get 3ltrs however sickening 😞
I did omit the Purchases column which replenishes the stock since I wanted to upload a less complicated file. I hope this answers your query on the negative value. In my original file, I have a data entry column which is simply what has been ordered by end users, a purchases column where items are procured. I also have the balances calculation file and unfortunately, this is where I hit a deadlock.
I do appreciate your feedback.
Let me read and digest this... I will definitely revert.
As for pulling items from Main, there is a control system in place and the issuing store can only get the minimum packaging quantity needed to fill their gap. E.g. if chemical XYZ is delivered by the supplier in 1ltr packaging and the issuing store have a shortage of 2.5ltrs, then they will get 3ltrs however sickening 😞
I did omit the Purchases column which replenishes the stock since I wanted to upload a less complicated file. I hope this answers your query on the negative value. In my original file, I have a data entry column which is simply what has been ordered by end users, a purchases column where items are procured. I also have the balances calculation file and unfortunately, this is where I hit a deadlock.
I do appreciate your feedback.