Issues with total days calculation as shown below snapshot orange colour:
Because Years and Months do not all contain the same number of days, DATEDIF can frequently give incorrect answers because of assumptions it makes in regard to the number of days in a month. As an example, consider:
=DATEDIF("31-jan-2023","1-mar-2023","md") => -2
For your particular calculations could use 0 for start_date and %Total Days for end_date,
But to correct the inherent flaw in DATEDIF you will need to write a routine that handles the difference in lengths of months differently. Or use it and accept that it may be inaccurate if the last month has fewer days than the first month.
Or, you could just define a year as having 360 days and a month as having 30 days as is done in some financial calculations.
Here is an example using DATEDIF which will be as accurate as it can be given the variability in the length of a month and year
Related
I have values corresponding to 'Calendar Days.' I'd like to convert this to 'Working Days.'
In this example, a 'Working Day' is defined by Monday through Thursday (4 days out of the possible 7 in a week).
Alternatively, I'd also like to convert 'Working Days' back to 'Calendar Days.'
The calculation will primarily be done and applied in Excel over many rows, so any MS Excel answers are appreciated.
Example:
This calculation can not be completed precisely from the data given.
In order to know exactly how many of the correct days there are in a period of that length, we would need to know the start day or end day.
However, we should get a reasonable approximation for large numbers like this by simply multiplying by our workday fraction. So n calendar days should be approximately n*4/7 working days.
This formula is pretty good for many purposes with large numbers, and will only be off by a few days at most.
However, it breaks completely for small numbers. For example, if our calendar days count was 3, the working days count could be 0, 1, 2, or 3 - and we do not have enough data to say which of those it actually is, given the current problem statement.
With similar caveats, the inverse operation should approximately go from working days to calendar days.
Also, real working days also often may be shifted around by holidays and the like.
I am trying to calculate revenue that is delayed by 4 months from the beginning of the year before receiving the full expected amount in month 5 and for the rest of the year.
In the attached picture you see that I expect 10,000 every month in 2021 with a 4 month ramp meaning in month 1 I will only receive 2,500 which is 10,000/4. In month 2 I will receive 5,000 which is 20,000/4 (10,000 from month 1 + 10,000 from month 2) and so on.
The problem is that the formula I use =SUM(OFFSET($G$14,0,0):G14)/$G$16 continues to sum and divide after month 5 and I would like it to stop at month 4.
I'd appreciate any help on tweaking my formula or recommending one.
Thanks
So I played around with the formula and figured out a solution. Tweaking the formula to the below allowed me to resolve the delayed revenue in case it helps anyone else.
=SUM(OFFSET($G$14,0,IF(MONTH(G11)<=$G$16,$G$16-$G$16,MONTH(G11)-$G$16)):G14)/$G$16
I made a worksheet covering meal expenses for a set period of time (01-08-2020 until 31-08-2020.)
The company will pay up to 75kr, Monday-Friday.
The list covers expenses 7 days a week, If the amount is greater than 75 on Monday-Friday, I have to pay the extra expenses. (This I have figured out correctly). Saturday and Sunday I have to pay fully.
So my question is, how can I sum this and exclude Saturday and Sunday?
Attempt 1:
I tried this formula (Norwegian excel. Summerhvis = SUMIF. Lørdag = Saturday):
=SUMMERHVIS(B2:B32,"<>lørdag", G2:G32)
It seems to be partly correct however, I miss Sunday, how can I add Sunday to this equation?
Attempt 2:
I used this formula:
=SUMMERHVIS(B2:B32,B2:B6,G2:G32)
It gave the correct answer but the answer was layered in 5 rows. I then summed this in P8.
Where I want the answer is in G32. So in G32 I wrote =p8.
It must be an easier way of doing this?
You can use SUMPRODUCT and the WEEKDAY function:
=SUMPRODUCT((WEEKDAY(A2:A32,3)<5)*G2:G32)
According to the Microsoft function translator, this might be, in Norwegian:
=SUMMERPRODUKT((UKEDAG(A2:A32;3)<5)*G2:G32)
If you really want to use SUMIF and your text days, one way would be (in English):
=SUM(SUMIF(B2:B32,{"Monday";"Tuesday";"Wednesday";"Thursday";"Friday"},G2:G32)),
or, if your weekday days are in b4:b8:
=SUM(SUMIF(B2:B32,$B$4:$B$8,G2:G32))
but I'd advise against it as it would only work in the language of the text days of the week. Also, I note your days of the week don't seem to match up with what the days of the week were in the US. For example, here 1 Aug 2020 was a Saturday, so another possible cause for error (unless I am not understanding the dates correctly).
The above is the same as summing five separate SUMIF equations, each for a desired day of the week.
I have a pivot table with a lot of items currently grouped by date into quartiles and then months under that. My question is this, Our Financial year is not Jan to Jan so can I set up quartiles to reflect this? also our financial periods are not simply set months, they follow the months but are always full weeks around that. for example, P1 this year is 04/07/2015 - 07/08/2015. and Q1 would be 04/07/2015 - 02/09/2015.
Aside from manually grouping is there a way to set this up to happen automatically within Excel?
As stated by pnuts in the question's comments:
The most practical way may be to define the quarters (?) in your source data.
If you are at least using a Gregorian calendar, you may want to subtract an offset from your dates (i.e. # of days between 01-Jan-YYYY and DD-MMM-YYYY ... whereby the offset YYYY doesn't need to be the same as your date's YYYY). By this subtraction you get an "ordinal number" of the date within your business year.
[offset] =[FOY]-DATE(YEAR([FOY]),1,1)
So with your year starting on [FOY]=04-Jul-2015, you have an offset of of 184 days and a normalized date of
[date_normalized] = [current_date]-[offset]
So 04-Jul-2015 will be shrunk to 01-Jan-2015. Now the quarter easily calculates to
=CEILING(MONTH([date_normalized])/3,1)
... or =VALUE(MID("111222333444",MONTH([date_normalized]),1)) ... if you prefer
For your not-quite-months always being full weeks, I suggest to calculate a week number by
=MOD(CEILING(([date_normalized]+1)/7,1)-1,52)+1
to create a weekly reporting period 1 .. 52. With a further =CEILING(.../4,1) this can be converted to quasi-months having 4 weeks each.
I'm stuck creating a formula that will calculate days before the end of the month then adjust to make sure it is a business day. For example: 30 days before 6/30/2015 is 5/31/2015 which is a Sunday. I need that to adjust to the Friday before.
I'm working on finding the due dates of a number of documents that are due a certain number of days before another date. For example: documents are due 30 days before the last day of the month. However, the number of days varies and the due date needs to fall on a business day (Monday-Friday). Sometimes it's 30 days, sometimes it's 60 days, sometimes it's 30 calendar days + 5 business days, etc.
I've been able to calculate 30 days + 5 business days with the following formula:
=workday(start_date-30,-5)
Any ideas how to adjust this so that I can just have the due date be 30 calendar days before a certain date but also always be a business day?
Using WORKDAY you can use a formula like this:
=WORKDAY(A1+B1+1,-1)
where A1 is your start date and B1 the number of days to add.
You probably need to write a macro function or maybe some nested IF statements in your cell's formula.
Take a look at http://www.mrexcel.com/forum/excel-questions/481558-round-date-nearest-workday.html
That solution moves forward to the nearest workday, but the principle is sound: just subtract instead of add.