Excel formula for an average where the price increases every day - excel

Can some one help me with a simple forumla in excel for the following problem.
I need to be able to predict an average price for the month. For example, if the current price is $1000 and there are 5 days left until the end of the month, I believe the price will increase £50 p/day. 1050 then 1100 1150 etc So the average price for the last six days will be 1100?
i would like to be able to do a forumla that works it out from the current price, the increase amount and the days left with out having to have a cell for each day etc?
Is this possible? i have tried google but have come up with nothing, a difficult question to articulate.

Sounds like you're having troubles finding the days in the month and the percentage of the month that has already passed / left
To calculate the number of days in the current month use this formula
=EOMONTH(NOW(), 0)-EOMONTH(NOW(), -1)
To calculate the current day of the month use this formula
=DAY(NOW())
To calculate the percentage of the month already gone
=DAY(NOW()) / (EOMONTH(NOW(), 0)-EOMONTH(NOW(), -1))
To calculate the percentage of the month remaining
=1 - (DAY(NOW()) / (EOMONTH(NOW(), 0)-EOMONTH(NOW(), -1)))

I'm not clear what you are averaging - is it 5 days or 6?
If you start with 1000 and average 5 days then you are averaging 1000, 1050, 1100, 1150 and 1200 so the average is 1100 - if that's the required result try this formula
=A2+B2*(C2-1)/2
where A2 is price, B2 increase amount and C2 days left
If you are averaging 6 days then that starts at 1000 and ends at 1250 so average is 1125 and the formula should be:
=A2+B2*C2/2

Related

Simple(r) Excel formula to calculate forward stock (inventory) cover

This is a perennial question for retailers, for which there are a number of solutions in existence:
How can you calculate the "forward cover" of a product knowing its current inventory and armed with forward sales estimates.
eg.
current inventory 100 units (cell A1)
weekly forward sales estimates: 25, 30, 10, 40, 90... (in range
A2:AX)
Here the answer would be 3.875 weeks (3 full weeks plus 0.875 of week 4)
I have a UDF to do this already.
I also have some slightly complicated array functions to do this, eg.
=MATCH(TRUE,SUBTOTAL(9,OFFSET(A2:A13,,,ROW(A2:A13)-ROW(A2)+1))>A1,0)-1+(A1-SUM(A2:INDEX(A2:A13,MATCH(TRUE,SUBTOTAL(9,OFFSET(A2:A13,,,ROW(A2:A13)-ROW(A2)+1))>A1,0)-1)))/INDEX(A2:A13,MATCH(TRUE,SUBTOTAL(9,OFFSET(A2:A13,,,ROW(A2:A13)-ROW(A2)+1))>A1,0)-1+1)
I was wondering if there is a neater way with these 'new-fangled' array functions which have been available for the last few years in later versions of Excel?
Here is another possible solution, although it requires the LET() function which is only available to newer version of excel (2021, 365 and later I believe).
The solution would be the following formula:
=LET(
sales,A2:A50,
inventory,A1,
cum_sum,MMULT(SEQUENCE(1,ROWS(sales),1,0),(ROW(sales)<=TRANSPOSE(ROW(sales)))*sales),
week_full,MATCH(TRUE,inventory<cum_sum,0) - 1,
week_frac,(inventory - INDEX(cum_sum,week_full)) / INDEX(sales,week_full + 1),
week_full + week_frac
)
Explanation
Given inventory and the forward looking sales estimates, the formula calculates the running total (i.e. cumulated sum) of the sales estimates as shown in the table here below
Inv and Sales
Cumulated Sum
Inv > Cum_Sum
Week
100
25
25
0
1
30
55
0
2
10
65
0
3
40
105
1
4
90
195
1
5
...
...
1
6
The formula goes on to get the number of full weeks of 'forward cover' by finding the the value for the cumulated sum that exceeds the inventory minus one (here 4 - 1 = 3).
Lastly, for the value of the week fraction covered in the last week, the formula calculates inventory minus sum of sales estimates of all previous weeks divided by sales estimate of final week of cover (i.e. (100 - 65) / 40 = 0.875).
Edit
After simplifying the formula you used with the LET() function, I noticed it's doing exactly the same calculation with the only difference of how the cumulated sum is being calculated. Here's your formula using LET():
=LET(
sales,A2:A50,
inventory,A1,
cum_sum,SUBTOTAL(9,OFFSET(sales,,,SEQUENCE(ROWS(sales)))),
week_full,MATCH(TRUE,cum_sum>inventory,0)-1,
week_frac,(inventory - INDEX(cum_sum,week_full)) / INDEX(sales,week_full+1),
week_full + week_frac
)
=LET(inv,A1,
sales,A2:A6,
cs,SCAN(0,sales,LAMBDA(x,y,x+y)),
m,XMATCH(A1,cs,1)-1,
m+(inv-
IF(m=0,
0,
INDEX(cs,m)))
/INDEX(sales,m+1))
SCAN() is perfect for creating a cumulative sum.
It can be referenced inside XMATCH because of the use of LET.
Here m returns the number of full weeks and the final calculation is the number of full weeks + (inv- cumulative sum up to the full week)/sales of the following week.

Rolling last 3 month average column in Spotfire

I'm trying to calculate for rolling average last 3 months . i'm stuck up to this calculation and could not figure out on how to inject this in spotfire using the logic.
the first month (feb) will use the recovery% as multiplier for wip% + recovery%
for the second month (mar) will get the average of (feb) and multiply to wip% +recovery%
for the 3rd month (apr) will get the average of (feb ,mar) and multiply to wip% + recovery%
for the 4month (may) will get the avg of (feb,mar,apr) and multuply to wip% +recovery%
my ultimate goal is to create a column for rolling average 3 months to be use in barchart and cross table. any help is very much appreciated. Thank you.
attached sample table
using below code it's giving me different result. there are no data for the first 2 month (Feb and Mar) and also the average i'm getting for the 3 months rolling is including the current month which the 3months rolling will start from the previous month.
(Sum([WIP]) / Sum([Assy Input]) * Sum([Recover]) / Sum([Input])) + (Sum([Recover]) / Sum([Input]))
THEN Avg([Value]) OVER (LastPeriods(3,[Axis.Rows])) THEN If(Count() OVER (LastPeriods(3,[Axis.Rows]))=3,[Value],null) as [3 mos Rolling]

Excel Time Comparison and Subtraction

I am trying to do a time subtraction in excel of 30 minutes and I am running into a speed bump. So the table I have are as follows.
Table "Schedule"
Column 1 is day of the week (Mon-Sun) (formated as general, as this is plain text)
Column 2 is start time of the shift (formated as h:mm AM/PM)
Column 3 is end time of the shift (formated as h:mm AM/PM)
Column 4 is duration of the shift (start to end) (formated by formula (TEXT(col3-col2,"h:mm")) )
Column 5 is paid hours (if the total hours is over 6.5 then subtract 0.5 hours for an unpaid lunch) (formula IF(col5>"6:30",col5-"0:30",D5) )
The issue is any time allotment over 10 hours start to end (where column 4, the duration hits 10 hours) no lunch is subtracted at all.
So...
Start 9:00 AM, End 6:59 PM, Hours Total 9:59, Hours Paid 9:29
But...
Start 9:00 AM, End 7:00 PM, Hours Total 10:00, Hours Paid 10:00
and that should obviously not happen. I can't find anything on google so I figured the excel gurus here may have some advice.
Thanks!
If your time columns are stores using excel's dedicated time format, this should be straightforward. Mixed data types are likely your problem.
First, be sure your time columns (columns 2 and 3) are set using the time function, i.e.,
=time(hours,minutes,seconds)
Then, you should be able to add and subtract easily.
Column 4: = column 3 - column 2
... then subtract 30 minutes also using the time() function:
Column 5: = if(column 4 > time(6,30,0),column 4 -time(0,30,0),column 4)
Excel stores time values from 0 to 1. So 24 hours=1, 12 hours=.5 etc. That means 6.5 hours=0.270833333 and .5 hours=0.020833333. As a result you can just do a simple if statement.
=IF(D2>0.270833333,D2-0.020833333,D2)
To turn it into a time format, is to just use excel's time formating options.

calculate cost from hours worked

I have two columns in my spreadsheet.
A B
Total Hours Worked Total Cost
A is formatted as a duration/time, i.e. 01:34:20 and is the total elapsed time it's taken to complete a task
B should be a formula of some sort that calculates the cost. Right now I have the function A2*25 but this results in B2 being too little.
What do I need to do to correct the formula so the total cost is correct?
You can use this as B2 -
=(HOUR(A2) + MINUTE(A2) / 60 + SECOND(A2) / 3600)*25
Excel stores durations as fractions of days.
You just need to multiply the duration by 24 to have the number of hours worked and you get the correct result.
=A2*25*24

Calculating the average difference in days within a period

I am trying to calculate the average difference between two columns in excel. The columns contain a planned and an actual date, I would like to get the average difference but only for planned dates within the last three months.
Example:
Planned Start Date | Actual Start Date
21/09/2013 | 25/09/2013
10/07/2014 | 16/07/2014
01/06/2014 | 30/06/2014
The formula should only take line 2 & 3 (line 1 is older than 3 months), look at the difference in days for each applicable line (line 2: 6 days, line 3: 29 days) and then show the average ( 17.5 days) of all applicable lines.
Does anybody have a formula for this? Excel really isn't my strong suit...
Assume your data is in A2:B4 then try this array formula
=AVERAGE(IF(TODAY()-A2:A4<=90,B2:B4-A2:A4))
It assumes each month is 30 days (hence the 90)
Press CTRL + SHIFT + ENTER to enter the formula as an array formula
Based on your example I get a result of 17.5 days.

Resources