Multi flow storage tank issue - excel-formula

I have a set of data where varying volumes of gas are being produced every hour of the year (8760 data points) (say i1,i2,...i8760), this gas gets stored in a tank of volume "V". This gas will run one or two engines based on the following criteria:
Run engine 1 all the time which consumes volume A every hour
Run engine 2 when the volume stored in the tank exceeds 0.75*V and run until it falls to 0.25*V
How can I create a model for this in excel? I want to calculate the no. of hours engine 1 and engine 2 can run in a year with the above mentioned constraints.
Thank you in advance for your help.

The various constants are set up in cells A2:E2 then there are 3 formulae:-
In J3, it just adds the new input volume to the volume at the end of the previous cycle:-
=L2+I3
In K3, it tests to see if engine B should run:-
=OR(J3>$D$2,AND(K2,J3>$E$2))
In L3, it works out the volume at the end of the cycle:-
=IF(K3,J3-$B$2-$C$2,J3-$B$2)
It needs some more work to deal with the cases where the tank gets completely full or completely empty.

Related

Dynamic condition formatting in excel

I'm trying to improve one of my sheets and implement some smart conditioning in it.
The sheet holds information about 3 KPIs regarding parts in a production process.
Now those KPIs are measured on a monthly basis.
If each of them is smaller than 1% for 6 consecutive months the sample size reduces to a lower sampling tier from 100% to 50%.
If such a trend is seen for the next 6 months, the sample size will reduce again to a lower tier from 50% to 25%.
There are four tiers together, with the last tier being 10%.
Now in case any of the KPIs is above 1% the sample size goes back to the previous sample tier. For example, the KPIs were under 1% for 13 months. The sample size was reduced to 25%. In the 14th month, one KPI was 2%, so the sample size must increase to the previous threshold which is 50%.
Currently, I'm using an excel file that marks in the sheet a 0 next to KPI that failed for a specific month and 1 for the ones that have passed. As the next step, those values are dropped into one cell, creating a string of 1 and 0 for each KPIs. Then I need to manually analyse each string and establish the sample size.
Please keep in mind that every month new data is added.
Added a picture and sample data:
https://docs.google.com/spreadsheets/d/1g2tMkUHb_gn4EYegr0aPp3bqr5dwYusg/edit?usp=share_link&ouid=108643160822075860310&rtpof=true&sd=true
Does anyone have an idea how this could be automated?

Facing difficulty in Excel when creating a logic for moving average of different variables

So, the point is, in my dataset I have to create a variable "Moving Avg. Amt paid per sq. ft." and the formula or the logic I need is to calculate the last five values as per most recent transactions. i.e. most recent sales by date. but this average should only return value in case it matches the same building and same area variable.
This is what my data looks like
Area ID has three categories. Building number has 5 categories. Date is sorted in ascending order. Now my variable moving average should calculate last 5 averages w.r.t date but for the same building in the same area. e.g. there are buildings 1 and 2 in area 102. I need my Mov Avg. variable to calculate using conditions when it matches criteria of building 1 in 102 for past five sales and when it finds building 2 in the building number variable, it should calculate average of last 5 sales of that building in area 102.
So my approach to this issue was (which is flawed at the moment):
I calculate average of amount paid per sq. foot w.r.t area & building based on dates using the formula
=AVERAGEIFS($N$2:$N$6547,$D$2:$D$6547,D14,$C$2:$C$6547,C14,$B$2:$B$6547,B14)
but I cannot make this formula work, to calculate moving average whenever it meets the criteria. I tried the offset the point as well by 5 but the logic is not right and hence its not working and returning #value in the cells. The formula I used to offset the above condition is
=AVERAGEIFS((OFFSET(N13,5,,5)),$D$2:$D$6547,D13,$C$2:$C$6547,C13,$B$2:$B$6547,B13)
(These formulae are used in column Q of my data)
Need a support from the community as I am badly stuck in making this data useful and I am out of any ideas to make this work.
Edit 1: I am not sure how I can attach my excel file here so you may review the dataset. I have uploaded it on a third party site, for which the link is shared below, so you can view the file in detail.
https://file.io/hlciAHJOHzWA
Expected result is as I have mentioned the instruction said
"Create a variable called "mov. avg amt. paid per sq ft". For each row, this variable should calculate average amt paid per sq ft for the most recent past five sales (by date) for the same building in the same area."
And my approach to build a logic or formula to make this variable calculate moving average w.r.t date for same building in the same area doesn't seem to work because there might be some flaws.
In Office 365 you could use:
=LET(f,FILTER($N$1:N13,($B$1:B13=B14)*($C$1:C13=C14),""),
c,COUNTA(f),
s,SEQUENCE(5,,c-5),
IFERROR(IF(c<5,SUM(f)/c,SUM(INDEX(f,s))/5),""))
If there's less than 5 matches prior to the current sales it'll calculate the average of the count. If 5 or more matches it'll calculate the average of the last 5 prior to the current sale.

Calculate minutes in specific period

I have a spreadsheet which has employee working times, listed as Sat-In and Sat-Out for a specific date. The employee shift spans several ours and each "In-Out" period is recorded as a separate line which means the time between the Sat-Out and the next Sat-In means the employee is on a break. I also calculate the time, in minutes of each "sitting" period.
What I can't seem to figure out is how to add a formula which takes the data and further refines it in this manner:
1. I have a core period of 1030-1530, as an example, which is the busy time and requires the maximum employee coverage. The shifts of employees generally spans this core, but in some cases their shift may start or end in the core.
2. I want to calculate how many minutes the employee worked within the core only. I can obviously do this manually using the data, but a formula would be preferred, if possible.
3. As an example, if a person sat-in at 1445 and sat-out at 1545, the core time calculation would be 45 minutes (1445-1530).
I've attached a snapshot of the data to help my explanation.
FYI - the information is pulled from a database as JSON data and converted to excel. I'm not very familiar with JavaScript, but if someone knows a way to do it programatically, I'm willing to give it a try and learn.
Thanks!
![excel]: https://photos.app.goo.gl/dRSTE72CXNa18RzP8
In below example I've used: =MAX(0,MIN($O$2,H2)-MAX($O$1,G2)), and formatted like [mm].
In Excel, units are days, so if you want to calculate the amount of minutes between two timestamps, you need to subtract both and multiply the differencee by 24*60 (being the amount of minutes in one day).
E.g. You start working at 09:07 (cell B2), and finish at 18:07 (cell B3), having a 45-minutes break. Then the time you worked in minutes, is:
=(B3-B2)*24*60-45
Make sure the cell formatting is correct (general), you'll get : 495.

How to count random rows

I have a problem trying to come out with a solution for my job.
I work at a warehouse and we work on containers. Each containers has X amount of boxes and X amount of paperwork for the boxes. We are also given a due date.
I wanted to use some kind of algorithm or formulas but I don't know how to use it of any kind.
Lets say i have 1000 containers and 700,000 boxes&28,000 Paper Work to be done in the next 7 days with 2 different shifts. For those containers I already have a list of the 1,000 of what needs to be done, but i want to do it quickly with excel to distribute the work based on categories. In those 1000, I also have a due date. So lets say I want to do 72 Containers per shift (144 for 1 day). I also want to do 50,000 boxes each shift with 2000 paper work also each shift.
My priorities is first Due Date, if a container is getting close to current date, that takes priority(lets say within 1 day). Next if i want to do 50,000 boxes and 2000 paper work per shift, i want to insert that into a cell and excel will automatically select the best 72 containers per shift that prioritizes due date(doesn't matter how many boxes or papers if it is within 1 day)and then chooses what ever best containers that will equal out to 50,000 boxes and 2,000 papers. Each container and its information in written per row with the columns having headers. I want it to be done this way so that i don't manually count each container so that i can best distribute the same amount of work to each shift. This way my 1 hour process can be done in 5 minutes.
I don't know if i am asking too much but i just need a sample to then test it on a file.
Sorry for providing the wrong information right away. I've included a sample of what I am trying to achieve.
Instead of 72 containers, with the example I lowered it 11 per shift but the boxes and paper count didn't change.
Container List
What this shows is that the yellow highlighted were selected because of due date being very close to current date. Orange highlight were selected to complete the 11 container count goal while being as close as possible to 50k boxes and 2k load slips. Then were sorted for email purposes, the other 11 were also already selected for the 2nd shift when they come in keeping in mind of the same goal as 1st shift. Any left containers are going to ignored at least till the next day.
Is this possible or am I thinking too far ahead of myself.

How do I use Goalseek function in excel to generate a series?

am struggling with the application of goal seek function in excel. Am forecasting production for an oil well however we have a target cumulative production expected after say 20 years of production. I have produced table columns of monthly production rate and cumulative production. I would like to play (create sensitivity scenarios) with my expected cumulative production.
Can i use goal seek to change the production forecast profile per month by just changing the cumulative production at the end.
Also advise alternative functions should goal seek not be the right function for this task.
Appreciate your support
This is really just an example of what #DanK has already mentioned. Say ColumnB figures are actual production (in black) and estimates (in blue). The estimates in this case computed as number of days in the month times the factor in D1 ("daily production"). To ramp up production so that the total cumulative production (in the example below, for 1-1/2 years, rather than all 20 as in the example above), presently estimated to be 115,620 units is instead 150,000 then Goal Seek might be applied so:
whereupon the D1 value (200) should change to 287 (and the total in B19 to 150,000, and all the blue values change also). The principle should work if, say, June 2015 were calculated as 16*D1 rather than 30*D1 to allow for planned suspension of production. If that fortnight were an intervention to add production from another reservoir anticipated to be 100 per day then Goal Seek would not adjust "100 per day" but would adjust a new daily rate of 1.5*D1.

Resources