Planning sampling date using several criteria in Excel - excel

I am trying to create a sampling plan for testing of raw materials. To provide some context, the criteria I am planning to factor in are the Priority level of the materials (e.g. P1 is the highest while P3 is the lowest), the delivery date of the material (Actual date of arrival), and the sampling capacity of each day (currently the capacity is at 30 SUs). If the sampling capacity of the day is exceeded, the date will be decided by back calculating using the lead times from the production need by date.
The main issue with the previous plan was that the dates were only planned around the priority level. This meant that regardless of the delivery date, whenever a new P1 item came in, it would push all the other lower priority items back, and create a backlog of untested items.
Using arbitrary values, if the material is P1, the date will be 12 days after the delivery date; P2, 13 days and P3, 14 days. After that, check if the sampling capacity is exceeded for the day. I tried to use Vlookup, but it only returns the first value rather than checking every row. I do not have Xlookup because I'm using Excel2016.
I want to create a code (either in VBA or excel) to factor in all these criteria to automatically plan a date.
The formula for sampling date based on just the priority level is =IF(C337="1", B337+12,IF(C337="2", B337+13,IF(C337="3",B337+14,""))), where C is the priority and B is the delivery date. This is what I currently have:
See below screenshot:

Related

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.

How do I add to a formula in Excel to ensure an allocated date is not repeated (except under a certain condition)?

My spreadsheet is used to show when something is due by based on a date entered and a frequency given:
The formula currently used to populate the due date is;
=IF(H7="Weekly",G7+7,IF(H7="Fortnightly",G7+14,IF(H7="Three Weekly",G7+21,IF(H7="Monthly",G7+30,IF(H7="2 Months",G7+60,IF(H7="3 Months",G7+90,IF(H7="4 Months",G7+120,IF(H7="5 Months",G7+150,IF(H7="6 Months",G7+180,IF(H7="7 Months",G7+210,IF(H7="8 Months",G7+240,IF(H7="9 Months",G7+270,IF(H7="10 Months",G7+300,IF(H7="11 Months",G7+330,IF(H7="12 Months",G7+365,IF(H7="Initial Visit",G7+31))))))))))))))))*
However, this could see multiple things being due on the same date, which I want to avoid to ensure workload is evenly distributed or limited to a maximum of 7 events per week.
What can be added to the existing formula to ensure that there can only be one event on one date and should the existing formula produce a date that is already taken it can allocate it the next available (closest date before or after duplicated due) date?
What you are describing are very specific conditions and implications which result in long formulas to fully incorporate all of them exactly.
To avoid the lengthy chain of IF clauses in that you have in your formula above, I would suggest splitting the column for the interval selection into two: one for the number value (1,...,n) and one for the interval class (weeks,months,initial visit).
Moreover, as shown in the screenshot below, I added an extra column for the priority of 'Initial Visit' and changed the formula used also for the non-adjusted due date for the new two interval specifying columns.
As highlighted in yellow, the due date for the 3rd job is being postponed by 1 day to prioritize the 'Initial Visit'.
The formulas are as follows:
Priority in F4 to F8 is =($E4="Initial Visit")*EDATE($C4,1)
Non-Adjusted Due Date in G4 to G8 is =IF($E4="Initial Visit",EDATE($C4,1),IF($E4="Weeks",$C4+$D4*7,IF($E4="Months",EDATE($C4,$D4),"")))
Adjusted Due Date in H4 to H8 is =($E4="Months")*(EDATE($C4,$D4)+SUM((($E$4:$E$8="Weeks")*($C$4:$C$8+$D$4:$D$8*7)=EDATE($C4,$D4))+(($F$4:$F$8)=EDATE($C4,$D4)))) +($E4="Weeks")*(($C4+$D4*7)+SUM((($F$4:$F$8)=($C4+$D4*7))+0)) +($E4="Initial Visit")*EDATE($C4,1)
A few other things should be noted though:
For the interval classes, only the selection (weeks, months, initial visit) is allowed. 'Fortnightly' or the like would be invalid.
Same due dates can still exist in the adjusted due date column.
A priority order has been introduced with the order of (months, weeks, initial visit) in ascending priority.
Meaning, for example, when two jobs have their time period given in the same interval class (e.g. 'Weeks') and the non-adjusted due date falls on the same date, the adjusted due date won't change it.

Excel Formula - Total subscriptions after Nth years based on monthly churn rates

A business works on a subscription model basis with a expected churn rate (Cancellations) each month during year 1 at 5% & during the following year a churn rate of 2.5% due to the fact these are now established customers (long term).
A new feature or service is launched with a expect increase of subscriptions each month. I need to calculate how many subscriptions would that be in N years based on a 5% churn rate for the first 12 month & a 2.5% churn rate during year 2.
Below is currently how were are calculating this in excel however this is really in inelegant solution when trying to calculate this for say 5 - 10 year impacts.
https://i.stack.imgur.com/yF5Rx.png
Are there any accounting formulas or something mathamitcally I can produce to calculate this in a single cell? Given I would need to set the given churn rates for each year & length of time.
For ease lets say 95% of the time I would be working on a 3 year model of subscriptions & each year will need its own churn rate.
I thought perhaps something with exp & halving the value might work but have not found anything yet.
Here's one way to build the model. I'll make reference to this image:
First we set up the churn model.
Row 1: Since Churn Rates depend on subscription age, Row 1 has the subscription age (in months). This is for reference only and is not used in the calculations.
Row 2: Churn Rates.
Row 3: Since Churn Rates always enter the calculation as (1-ChurnRate), call that term (Single-month) Retention Rate. As an example, in B3 the formula is =1-B2.
Row 4: Since the effects of churn are cumulative over multiple months, we define another term Multi-month Retention Rate (abbreviated MMRR). In the first month this is set to 1; in subsequent months this is the product of previous single-month retention rates. So in C4 the formula is =B4*B3; in C5, =C4*C3, etc.
Row 5: The model as described in the Question indicated a fixed rate of new subscriptions = 100/month. When the subscription rate is fixed, it is convenient to sum up the MMRRs. So in B5 we have =B4; in C5, =B5+C4; in D5, C5+D4; etc.
At this point we're essentially done. If you multiply the values in Row 5 by any fixed rate of new subscriptions (e.g. 100/month in the original Question) we get the number of subscribers in that month. But what if you want to model where the number of new subscriptions varies month to month? Here's how ...
The basic idea is to multiply the monthly subscription rate by its age-appropriate MMRR. Note that Row 8 has varying numbers of new subscriptions (100, 110, 97) in the first 3 months. To get the total subscriptions in Mar-19 for example, we need to
multiply the 100 (Jan-19) subscriptions (that have a 2 month age) by the MMRR for a 2-month old subscription (0.9025),
multiply the 110 (Feb-19) subscriptions (that have a 1 month age) by the MMRR for a 1-month old subscription (0.95),
multiply the 97 (Mar-19) subscriptions (that have a 0 month age) by the MMRR for a 0-month old subscription (1), and
add those three products together.
This could be calculated on the worksheet by entering in D9 the formula =B8*D4+C8*C4+D8*B4. This type of calculation (sum up the pair-wise products of two arrays) is often done with Excel's SUMPRODUCT function. Here we need to take one of the arrays in reverse order, which is not directly supported by Excel. You could enter new subscriptions in reverse order, but that's an ugly kludge. Fortunately, it is do-able with a combination of the OFFSET(), COLUMN() and N() worksheet functions (see here for details). The required formula for B9 is
=SUMPRODUCT($B4:B4,N(OFFSET(B8,0,-(COLUMN($B8:B8)-COLUMN($B8)),1,1)))
This can then be copy/pasted into the rest of row 9.
This model approach is pretty flexible: the churn rates (row 2) and subscription rates (row 8) can both be varied month to month; the total number of retained monthly subscriptions is calculated automatically.

Formula to offset a value in excel to a different column?

I am trying to create a formula that offsets an "up-sell" amount 12 periods (columns) in the future.
For background: Each of our customers provides monthly recurring revenue (like a subscription. At the beginning of the model (1/1/18), I have a random number generator from 1-20 that calculates the period in which the customer could be up-sold.
As you can see in the photo and the formula that the IF statement looks at the random upsell period and adds in the additional revenue ($100) into that period and periods after that.
I am trying to create the formula so that once the if statement is satisfied (the random period >= the period that the cell is in) it adds the revenue 12 periods later, not in that period itself.
For example, Customer ABC's random upsell period is 3, instead of adding that revenue in period 3, I want it to add it in period 15 (12 periods later).
The formula that is currently being used is: =IF($B8>E$5,$C8,$C8+$D$3)
Please see attached image for reference, thank you]1
Not sure if that's what you are looking for and only works if your periods increments in 1 even after 12++ (13,14,15...).
Sorry you'll have to redefine the references but that gives you an idea:
In C5 : IF(C$4>12,IF(OFFSET(C4,0,-12)>=$A5,$C$2+$B5,$B5),$B5)

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