How do I find the missing amounts between different months? - excel

So my problem is this, currently I have an amount of money with start date and end date. I'm able to calculate the beginning month and end month money but I'm having a lot of trouble trying to figure out the in between months amount. Then once figuring that out to combine all three equations into a single situation to be able to type in any start date, any end date, then amount that automatically calculates for each given month automatically.
The table looks like this:
As you can see it calculates May and August by pasting the calculations into those cells manually. But, I'm not able to figure out how to calculate the middle portion then putting the formula into one single formula to be able to automatically calculate.
The code that I currently have to calculate May is:
=(MAXIFS(Dates!$A:$A,Dates!$B:$B,VLOOKUP($B$2,Dates!$A:$C,2))-$B$2)/($B$3-$B$2)*$B$4
This calculation is essentially if the start date is on 5/26/2019 start at that date, to only calculate 6 days for this example. Then calculate the amount needed for those 6 days.
The August Formula is:
=IF($B$3<=MAXIFS(Dates!$A:$A,Dates!$B:$B,VLOOKUP($B$3,Dates!$A:$C,2)),($B$3-MINIFS(Dates!$A:$A,Dates!$B:$B,VLOOKUP($B$3,Dates!$A:$C,2))+1)/($B$3-$B$2)*$B$4,"No")
This does the same as May where when it ends, in this case 8/15/2019 it only calculates up until 8/15/2019 and not the entire fiscal month.
The Dates sheet looks like this:
This is just a sample of the data as the sheet itself is too big to show in a picture. But here is how it lays out for a Fiscal Year:
What I want the end result to look like is:
But also to have it automatic where anyone could enter in Start Date/End Date/Amount and it auto calculates everything for the person. The dates can go from February - January or just a single month as well.
Any help would be much appreciated and if anything needs to be expanded on please let me know as I'm not sure how to ask a question for this specific problem.
Thanks in advance,
-Maykid

Use an array formula:
=SUM(if(LOOKUP(row(index($XFD:$XFD,$B$2):index($XFD:$XFD,$B$3)),Dates!$A:$A,Dates!B:B)=C$1,$B$4/($B$3-$B$2)))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
Put in C2, hit Ctrl-Shift-Enter then copy over.

Related

Salary Calculation in Excel

So I have a problem that I'm dealing with for days now and I cant figure it out. I have this problem in excel, I am looking for assistance regarding a calculation. I want to be able to calculate a payment date schedule based on a set monthly payment date but to exclude exclude weekends and specific holiday dates e.g.
Here's My file I'm Working on:[].
Here is some function that I already used : =IF(TEXT(O2,"dddd")=$U$2,O2+2,IF(TEXT(O2,"dddd")=$U$3,O2+1,O2))This works for only weekends, It doesn't work on holidays, I want it to work not only on weekends and on holidays too.
Thanks in advance.
This can be done by using the WORKDAY() function together with the DATE() function.
B2 contains year - 2012
B3 contains payment day - 28
A5:A17 contain payment periods (month numbers) - 1..12
D6:D16 contain holidays
=WORKDAY(DATE($B$2,A6,$B$3-1),1,$D$6:$D$14)
Also see the linked image. (NB: My Excel version uses semi-colon ";" in stead of comma "," to separate arguments in functions.)
Best of luck!
Xharx
Image of the Excel sheet solution
Here's How u Do it. First we have to have starting month from where were gonna start counting I made this formula which works great, =WORKDAY(EDATE($B$15,COUNT($B$15:B17))-1,1,holiday1)
were freezing the starting date and counting how many rows are we from the starting position , then were gonna minus 1 from it , and in days were gonna type 1, if there's holidays that I wanna exclude too I just can enter it and give it a name, (Some of u who doesn't understand this, its just saying that its referring to specified cells which we named holidays) and it works flawlessly.
B15 = starting month

Excel WORKDAY.INTL Formula - Need Help Finding my Mistake - Formula Appears to be Miscalculating Date

Purpose of Post
Trying to determine why the WORKDAY.INTL formula in cell "F2" of the attached workbook picture seems to be calculating the incorrect date. I expected the date be 8/16/21. It is showing as 8/12/21.
The attached picture is a screenshot of my workbook that contains a table of tasks. The columns to the right of the tasks column are explained below.
Start Date: the date that the task will be started.
Due Date: the date that the task is due/will be finished.
Hours of Work: the estimated amount of hours that it will take to complete the task.
Percent Dedication: The percentage of my time in a workday that I will dedicate to that task.
Start Date Check: Calculates the latests day you can start the task to finish on the specified due date given the hours of work required and the percent dedication.
Due Date Check: Calculates when the work will be finished if started on the specified start date given the hours of work required and the percent dedication.
Working Hours: Number of hours in each working day.
Formulas in Cells
Cell "E2": =([#[Hours of Work]]/(NETWORKDAYS.INTL([#[Start Date]],[#[Due Date]],"0000111")*J1))
Cell "F2": =WORKDAY.INTL([#[Due Date]],(-1)*([#[Hours of Work]]/([#[Percent Dedication]]*J1))+1,"0000111")
Cell "G2": =WORKDAY.INTL([#[Start Date]],[#[Hours of Work]]/([#[Percent Dedication]]*J1)-1,"0000111")
Here's your problem in it's simplest form:
Column C shows the formulas that are being used in Column B.
The formula in B3 is displaying the correct answer.
However, the formula in B4 treats B3 as though it is -11. This is almost certainly due to floating-point arithmetic, especially considering that the 10/11 part of the formula is a non-terminating number. This is much too complicated of a subject to get into, but essentially it means that the result is not -10 and is something like -10.0000000...00000004815162342 because of the slight imprecision.
The solution is to round the result to an integer, so that we ignore the tiny amount of imprecision. For our test case, we would do this:
By rounding the answer, we have obtained the correct result.
For your workbook we can do the same thing. The formula in E2 would become:
=WORKDAY.INTL([#[Due Date]],ROUND(-([#[Hours of Work]]/([#[Percent Dedication]]*J1))+1,0),"0000111")
Which gives the correct answer:
I would suggest doing the same for the formula in G2 as well, which would be:
=WORKDAY.INTL([#[Start Date]],ROUND([#[Hours of Work]]/([#[Percent Dedication]]*J1)-1,0),"0000111")

Can I test my Excel formulas as if today was some day in the future?

I am building a new dashboard that refreshes on a daily basis. The dashboard includes current month data as well as prior month data. However, I need to try a few different scenarios in terms of dates to ensure that month transitions work with no problem. For example, I would like to know what my formulas would do when it is the first day of the month, and the second day of the month with different conditions such as the 1st day being weekends or holidays, etc, where I won't have any data, which would lead to errors.
I tried fixing formulas, but there were way too many formulas involved and related to each other. Also data is being pulled from SQL server, where I am also using GETDATE().
For example, one of my formulas show
=YEAR(TODAY()-1)&IF(MONTH(TODAY()-1)<10,0&MONTH(TODAY()-1),MONTH(TODAY()-1))
to get the year & month (e.g. 201904 for 2019 April). This is one of many formulas that has today() built in
In sum, I am wondering if I can change the date that Excel is reading off. For example, I have a formula with =TODAY() - I want this formula to return some other days I set to, rather than actual date of today.
First place this user defined function in a standard module:
Public Function todaz() As Date
todaz = Evaluate("=today()") + 12
End Function
Then in your worksheet, replace all instances of:
Today()
with:
todaz()
You can change the User defined function to have any date offset you wish.
When you are done testing, change all the todaz() back into Today().
Here's a non-VBA version:
Have a cell in which you put just =Today(). In the worksheet, replace all other instances of Today() with a reference to this cell. For testing, replace the Today() with whatever date you like, and when you're done, put the Today() back in.
Both this and Gary's Student's version have the advantage of being less volatile - that is, they will run much faster because Today() is one of those functions that recalculates frequently in every place it appears -- and in your case that sounds like a lot.

Using the 'TODAY' function

My spreadsheet is to show me how many days active a certain field has been.
For this I am trying to find a formula which will automatically take the entered date from one cell and deduct it from "todays" date.
As an example I have used =DATEVALUE("22/04/2017")-TODAY() - and although this works, i am unable to drag the formula down into other cells, to auto populate when a date has been entered/ amended. I'm having to enter the formula above every time, and if the date changes, as an example from the 22/04/2017 to the 20/04/2017, I would have to manually amend the formula too. How can I get it just pick up the date in that particular cell and deduct "today" from it?
Sorry if i'm rambling, I just don't know if I'm explaining myself properly.
Thank you
Typically, 'how many days active a certain field has been' would be a positive number (i.e. the number of days). Reverse the subtrahend and minuend to get a positive integer like this,
=today()-a3
To avoid getting 5/15/2017 or 42,870 as the result when A3 is blank, check to see if there is something in A3 before attempting subtraction.
=if(len(a3), today()-a3, text(,))

How do I shorten the formula for comparing two dates in excel standard date format?

I have created a formula to compare two dates. M673 is a date that is manually entered but sometime copied over which leaves that unnecessary " "in the front from time to time which makes the date extraction difficult (that's why I trimmed it). The date in N673 is extracted from a manually entered period (i.e. 08/2015) 08 is actually October (10). The extraction formula looks as follows:
(N673)=IF(A673="","",DATE(RIGHT(A673,4),LEFT(A673,2)+3,))
This is to ensure it updates for every period posted automatically.
The below formula says if M673 is before N673 but on the first day of that month and year, then it becomes 1 else its a 0.
Any way to shorten the below formula?
(G673)=IF(DATE(LEFT(TEXT(TRIM(M673),"yyyy-mm-dd"),4),MID(TEXT(TRIM(M673),"yyyy-mm-dd"),6,2),RIGHT(TEXT(TRIM(M673),"yyyy-mm-dd"),2))<(DATE(LEFT(TEXT(N673,"yyyy-mm-dd"),4),MID(TEXT(N673,"yyyy-mm-dd"),6,2),1)),1,0)
Have you tried to use DATEVALUE? The following should work for the scenario you have described above.
(G673)=IF(DATEVALUE(TRIM(M673))<N673,1,0)
There's no need to create a new date based on all the parts. This is what DATEVALUE will do for you automatically.

Resources