Having problems spreading expense over months with partial month calculation - excel

I am writing a nested if statement that will calculate monthly expense based on an "Expense Frequency" option. Most of them see to be working but I have two that will not work for some reason.
The first problem is the "Fixed" option - I want this to put the whole expense rate in the first month of the expense period. For some reason it is not triggering in the first month. I feel like this might be a simple fix?
The second problem is a little more complex. It is the "Spread Amount" option. When the months are full calendar months the calculation is easy, divide total expense amount by # of months. But when I factor in partial months the calculation diverges from what I am looking for. The shorter the time duration, the larger the variance is from the total expense. When I stretch the expense over a longer period the variance shrinks. It is a pretty complex calculation (I think) and basically I want to use days out of the month for the calculation in the partial months (first and/or last) and then whole months in the middle. I have attempted this in my attached spreadsheet and I thought it might work but it isn't. Is anyone able to help me out here? I would even be satisfied with a succinct explanation of why this calculation isn't possible / doesn't make sense / cannot be done so I can explain this to my boss. I am providing a cash reward for this if it can be handled in the next three hours. Please help!! Thank you!
This is my formula
=IF($I9="Spread Amount",IF(AND($J9<=O$6,$K9>=O$5),IF(EOMONTH($J9,0)=O$6,(($M9)/(DATEDIF($J9,$K9,"m")+1)((O$6-$J9+1)/O$4)),IF(EOMONTH($K9,0)=O$6,IF(EOMONTH($K9,0)=O$6,(($M9)/(DATEDIF($J9,$K9,"m")+1)(($K9-O$5+1)/O$4))),($M9-IF(ISERROR(HLOOKUP($K9,$6:9,$XFD9,0)),HLOOKUP(EOMONTH($K9,0),$6:9,$XFD9,0),0)-IF(ISERROR(HLOOKUP($J9,$6:9,$XFD9,0)),HLOOKUP(EOMONTH($J9,0),$6:9,$XFD9,0),0))/(DATEDIF($J9,$K9,"m")))),0),IF(O$7>$K9,0,IF($I9="EOQ",IF(OR(MONTH(O$7)=3,MONTH(O$7)=6,MONTH(O$7)=9,MONTH(O$7)=12),$M9,0),IF($I9="Spread Evenly",IF(AND($J9<=O$6,$K9>=O$5),IF(EOMONTH($J9,0)=O$6,$M9*((O$6-$J9+1)/O$4),IF(EOMONTH($K9,0)=O$6,$M9*(($K9-O$5+1)/O$4),$M9)),IF($I9="Fixed",IF(AND($J9>=O$5,$J9<=O$6),$M9,0),IF($I9="Repeat Annually",IF(MONTH($J9)=MONTH(O$6),$M9,0),0))),IF($I9="Odd Month",IF(ISODD(MONTH(O$6)),$M9,0),IF($I9="Daily",IF(AND($J9<=O$6,$K9>=O$5),IF(EOMONTH($J9,0)=O$6,($M9/($K9-$J9+1))(O$6-$J9+1),IF(EOMONTH($K9,0)=O$6,($M9/($K9-$J9+1))($K9-O$5+1),($M9/($K9-$J9+1))*O$4)),0))))))*1)
This is what the spreadsheet looks like

Related

How do you stop a draw commission after reaching a certain number while continuing commission earned after draw limit

so im very new to excel and I have a problem I need to solve for an internship im applying for. As a heads up I apologize for any confusion, but im happy to answer any questions that I may have left out from the explanation. Regardless I would really appreciate some help!
Question:
If someone starting at a company is allowed a draw of $5,000 a month if they earn a commission of less than $5,000, up to $30,000 within the first 12 months. If they make more than $5,000 in commission, they don't automatically get a draw of $5,000. After the first 12 months, regardless of their commission, they no longer are granted a draw.
How do I automate a draw up until $30k total commission if less than $5k for the first 12 months, and stopping the draw automation after either of those conditions are met while maintaining commission earned indefinitely.
What I have done so far
Again I probably formatted the whole book incorrectly for this. But thats the formula I have made for the calculation so far but I dont know how to make the draw stop after either 12 months or after reaching $30k automatically.
EDIT: heres the formulas I have made so far. Again im just starting to learn this so im probably far off. Sorry I forgot to add my formula

Calculating price per minute from total cost and minutes duration

So for an interview process I was given this workbook to complete the questions on, I have no experience with arithmetic and stuff like this in excel tbh so got stumped and just did the data manipulation ones - but for future how would you actually do this?
Ignore the formula in M I thought I could get somewhere dividing the cost by minutes but that's clearly wrong.

How to reference the previous month's high or low in a data set and compare it with the current value

I have an Excel spreadsheet of daily Open/High/Low/Close data for an stock index (link below) and wish to go through the data day by day to create a marker for each day. I would like this to be +1 if the high of the day is above the high of the previous month, -1 if the low of the day is below the previous month's low and 0 if neither of these conditions are satisfied. A previous answer on this forum showed me how to extract the monthly high and low for each month (also in the spreadsheet). It seems quite straightforward on the face of it but I can't seem to get anywhere. I've been trying to use nested "if" statements to do this. I have actually asked this question before but I had no response. Any help would be much appreciated.
Many Thanks, Paul
Link to image
https://imgur.com/gallery/rJen7xw

Part-time AL calculation

I know this isn't necessarily programming but I have used this community many a time and you have always been able to provide guidance or an answer.
My business have asked me to calculate the Annual Leave for all of our staff for 2019 and update this. They have altered the way they want the AL to be calculated and so the previous calculator I built is now obsolete.
I have managed to make the calculation work for my full time staff as I am not having to take their FTE into consideration, even when they move up to a higher allocation of AL, based on their service with the company.
When it comes to part time staff, we have to also add in the bank holidays as they are entitled to them, and then take out the hours that they would be working on those bank holidays.
My issue is when the agent changes allocation half way through the year.
This is the calculation for an agent that stays within their allocation for the whole year.
(Allocation+BankHolidays)x(FTE)x(TimeWithinYearSpentInAllocation)
So as an example the calculation would be:
(172.5+(8x7.5))x(15/37.5)x(365/365)=93
From that number we would then subtract however many hours they would be "working" on bank holidays.
My issue is when they change allocation the below calculation doesn't work.
(172.5+(3x7.5))x(15/37.5)x(120/365)+(187.5+(5x7.5))x(15/37.5)x(245/365)= 88 (rounded)
Can anyone help me on a calculation that will help me get there?
Regards,
Jordan.
Your problem is with the bank holidays. Just remove the allocation part and comapre the results:
((8*7,5))*(15/37,5)*(365/365)=24
((3*7,5))*(15/37,5)*(120/365)=3
((5*7,5))*(15/37,5)*(245/365)=10
this doesnt make sense. I dont know laws in your country, but for me if I work over public holidays I am entiteled to the same number of hours leave but here you calculate that if you work for 3 days of public holidays you are entiteled for 3 hours of leave. Shouldnt the days*hours be added after the multiplication of the allocation?

Complicated formula required to work out costs including multiple discounts

I'm looking to compute and show individual row totals and a Grand Total. I just need the formulae to put in the boxes so the calculation is automatic but the problem is the calculations are a little complicated...
I'm using data validation to select the day type. This is what I think I need:
Assign a price to the day type (either Standard day = £23 or Extended day = £26).
Apply a volume discount where appropriate. If Jack is attending all week (5 days) and the day type is the same for all (all Standard or all Extended), the total cost is £100 (or £120)
Else the total number of days needs to be added up for Jack. (Number of days for each ‘day type’) and priced up.
For his siblings after the first, as above but apply an additional discount of 15%.
The grand total then needs to show at the bottom.
Well, it is not the best of data layouts but this may serve, in L6 and copied down to L13:
=IF(OR(A6="Brother",A6="Sister"),0.85* IF(COUNTIF(B6:F6,"Standard day")=5,100,IF(COUNTIF(B6:F6,"Extended day")=5,120,COUNTIF(B6:F6,"Standard day")*23+COUNTIF(B6:F6,"Extended day")*26)), IF(COUNTIF(B6:F6,"Standard day")=5,100,IF(COUNTIF(B6:F6,"Extended day")=5,120,COUNTIF(B6:F6,"Standard day")*23+COUNTIF(B6:F6,"Extended day")*26)))
and =SUM(L1:L16) in D16.
It would be better practice not to hard code the daily rates/discount, but extracting these from C1:D2 would have increased the length of the formula further.
Note also the result is not £429.95 (you may have changed your example after doing your calculations).

Resources