Retrieve cell value based on date Excel - excel

I'm working on a time sheet for my work schedule. In column A I have the start dates of each week. In the second column I have how many hours I work that day. I am payed on the 22nd of each month. I want to have a running total of how much I have earned in a month before payday. That is to say on the 21st I know how much money I will be paid the next day from my spreadsheet.
I want to SUM the values of column B but only for the weeks which lie between the 22nd of 'April' lets say and 'May'.
Therefore based on the value of the start date of the week, I need to obtain the information adjacent to the weeks, for a set of weeks and sum it to find the number of hours I've worked this paying month. I want this to happen automatically, so it will change automatically.
I have attached a screenshot which might make this clearer, I have added a couple of other names as additional variables.
Thank you in advance,
Maksim Richards

If the amounts that you'll get in next month's pay haven't been filled in yet (which is the question you're asking because you want to find out on 21st May how much you will be getting) then you just need to sum the amounts for the weeks starting 22/4/16 onwards in G9:-
=SUMIF($A$4:$A$11,">="&DATE(YEAR($F$2),MONTH($F$2)-1,$G$2),B$4:B$11)
where today's date is in F2 and payday in G2.
Then the pay so far is:-
=G9*24*$H$2
where the hourly rate is in H2 (result may appear formatted as date: if so, change format to general).
If you wanted to check back after some of next month's hours had been put in the spreadsheet and see if what you've actually been paid is the same as your calculated pay you would need a SUMIFS:-
=SUMIFS(B$4:B$11,$A$4:$A$11,">="&DATE(YEAR($F$2),MONTH($F$2)-1,$G$2),$A$4:$A$11,"<"&DATE(YEAR($F$2),MONTH($F$2),$G$2))
I haven't used TODAY to get today's date because it's volatile and if you use it, it will keep prompting you to save the spreadsheet when you close it even if you haven't changed anything.

Related

How to do I use Excel to make three cells change when any of the others are changed?

I want to make a table that can calculate the cost per week, per month and per year of any value.
If the per week value is entered it needs to calculate the per month and per year value.
If the per month value is entered, it needs to calculate the per week and per year value.
If the per year value is entered, it needs to calculate the per week and per month value.
I can only use three cells.
I haven't a clue how to do this. I don't even know how to run the code in Excel. I heard you have to use VBA but I have never touched Visual Basic let alone, used in in Excel.
Please can some one help. This is very important to me. Thanks in advance for any help :)
Going with a more formula driven route, I would suggest using an input range and a result range. In the attached screenshot, the blue cells are for inputs while the below formulas go i the row below the inputs.
For days
= if(not(isblank(A8)),A8,if(not(isblank(B8)),B8/30,C8/365))
For months
=if(not(isblank(A8)),A8*30,if(not(isblank(B8)),B8,C8/12))
For years
=if(not(isblank(A8)),A8*365,if(not(isblank(B8)),B8*12,C8))
Note1: I assumed 30 days a month and 365 days in a year.
Note 2: The order the formula calculates is first days, then months, then years. So, if something is in days it will need to be cleared out when inputting months and so on.

How to select the last day of selected months in daily data in EXCEL

I have daily data from 01-Jan-2005 till 29-Dec-2017. I want for each year to select the last day of March, June, September, and December, alongside their respective data. Part of the data:
Date Variable
30-Mar-2005 1.2943
31-Mar-2005 1.2964
1-Apr-2005 1.2959
4-Apr-2005 1.2883
5-Apr-2005 1.281
I.E: For 2005, I want the dates of 31-March-2005, 30-June-2005, 30-September-2005, and 30-Dec-2005. Desired output:
Date Variable
31-Mar-2005 1.2964
30-Jun-2005 1.9859
30-Sep-2005 1.2233
30-Dec-2005 1.2814
I currently have the build in excel formulas (i haven't installed any other plug-ins etc).
More specifically: on the left i have the data, and on the right the desired output.
Not sure if this is going to work to you, but anyways.
Looks like you always look at the last day of months March, June, September and December on a specific year (in example, 2005).
But you are not looking for the last natural day of each month. You want the last day of each month that appears in your data (in example, that explains why you use 30 december 2005 instead of 31, because there is no 31).
In Excel, dates are numbers. The more you go in the future, a bigger number is related. Knowing this, you can get the date for each month just looking the MAX value of a range of dates.
But first, you need to define the range of dates, using 2 conditions:
Month of date must be March, June, September and December
You want dates for a specific year (in example, 2005).
To get this, you need an array formula. My formula gets the max day of a specific month and year. To test it, in my Excel I did a dates series, starting in 01/01/2005 and done in 31/12/2017. I deleted manually 31/12/2005 because that date has no data.
In cell I4, just type the year you want to check. The formula will get he last day of months March, June, September and December of that year.
My array formula is:
=MAX(IF(MONTH(IF(YEAR($A$4:$A$4750)=$I$4;$A$4:$A$4750))=3;$A$4:$A$4750))
IMPORTANT!: Because it is an array formula, you will need to type it
as usual, and then, instead of pressing Enter press
CTRL+SHIFT+ENTER
You need 4 times this formula. Just change the 3 (March) for the number of the month you need (6,9 and 12).
Now that you have the dates, you just need a VlookUp to get the value you want.
=VLOOKUP(G5;$A$4:$B$4750;2;false)
If I change the year value, i get those new values:
If you want to check the file. I uploaded an example to Gdrive, so you can download if you want.Download
Anyways, try to adapt this formulas to your needs.
I converted a list of Euro conversions into a Table and used structured references. But you can use normal range references if you prefer.
In some other table, enter the following formula, where $A$45 refers to the first quarter ending date in your data table.
F2: =IF(EOMONTH($A$45,(ROWS($1:1)-1)*3)>MAX(Table1[Date]),"",LOOKUP(2,1/(EOMONTH($A$45,(ROWS($1:1)-1)*3)>=Table1[Date]),Table1[Date]))
In the adjacent column, enter the formula:
G2: =IFERROR(VLOOKUP(F3,Table1,2,FALSE),"")
And fill down until you get blanks.
(in my sample table, the last date is 1/27/2006 so the last included "End date" is 12/30/2005, there being no data for 12/31/2005)
So, there are two cases
When you have the exact last days of the month. (Its simpler).
I had a fortnightly data. I adopted this simple and innovative method. From all the dates, I first extracted the day using Day() function. for example, Day(A1). (Remember, while doing this, do not delete your original date column. Do it in a separate column as this would help you match the dates later).
Then I sorted the data using the Day column, just constructed before, in decreasing order. This would place all end dates at first. And then deleted the starting dates which were at bottom. So, now I am left with only end dates but obviously months are not in order.
So, create another column extracting just the month and year from the original date column using =MONTH(A1) & "/" & YEAR(A1). Sort the data using this column. And, you are good to go!
When you do not have the exact last days, but maximum dates like the one shown above in picture.
In this, while deleting the initial dates, you would have to take care of which date on-wards you need to delete.
For example, I deleted day 17 on-wards of months with 31 days (including day 17) and day 16 on-wards of months with 30 days (if present) because if there was this date, suppose, 18 April 2018, then this would be the last day of the month as I had a fortnightly data.

COUNTIF formula using variable dates

Morning all,
Let me explain my predicament! I'm putting together a set of reporting figures for my employer based on a spreadsheet containing work that's been completed so far this year. I need to report on the total volume of work completed and the average turnaround for this work, split by Week to Date, Month to Date, and Year to Date (WTD, MTD, YTD).
This is something i've put together manually so far but i want to produce a formula which allows my employer to generate his own figures based on a week-ending date he can pick from a dropdown list (held in cell D4).
So far i've been able to generate the below COUNTIF formula to give me the WTD figures for work volumes completed within 7 days of the week ending date in cell D4 (with the completion date being held in 'Completed!O:O'):
=COUNTIFS(Completed!$O:$O,">="&D4-6,Completed!$O:$O,"<="&D4+1)
I'm also using the below AVERAGEIF formula to show the average turnaround (the Turnaround figure is held in 'Completed!P:P'):
=AVERAGEIFS(Completed!$P:$P,Completed!$O:$O,">="&D4-6,Completed!$O:$O,"<="&D4+1)
I've been trying to come up with similar formulas to tell me the MTD and YTD figures but with no success. I originally had the MTD formula return the value based on work completed within 31 days of the Week-Ending date but this was incorrect. If the week-ending date of 03/02/2017 if selected then i only need it to show the count of work completed between the 1st and 3rd of Feb. I'm sure once i work this one out that i'll be able to use a similar formula to show me YTD figures.
Any help or guidance you can offer is appreciated! Cheers.
For the MTD count, use:
=COUNTIFS(Completed!$O:$O,">="&DATE(YEAR(D4),MONTH(D4),1),Completed!$O:$O,"<="&D4+1)
For the YTD count, use:
=COUNTIFS(Completed!$O:$O,">="&DATE(YEAR(D4),1,1),Completed!$O:$O,"<="&D4+1)
For the MTD average, use:
=AVERAGEIFS(Completed!$P:$P,Completed!$O:$O,">="&DATE(YEAR(D4),MONTH(D4),1),Completed!$O:$O,"<="&D4+1)
For the YTD average, use:
=AVERAGEIFS(Completed!$P:$P,Completed!$O:$O,">="&DATE(YEAR(D4),1,1),Completed!$O:$O,"<="&D4+1)
a fellow helpful user has assisted and i now have formulas that work.
For MTD, i'm using the following:
=COUNTIFS(Completed!$O:$O,">="&EOMONTH(D4,-1)+1,Completed!$O:$O,"<="&D4+1)
And for YTD:
=COUNTIFS(Completed!$O:$O,">="&DATE(YEAR(D4),1,1),Completed!$O:$O,"<="&D4+1)
Thanks for everyones help!

Display the upcoming due date

I am working with Microsoft Excel for Mac 2011 doing some personal finance and trying to devise a formula to display a specific date.
I have a credit card bill that is due on the 24th of every month. I have the name in Column A, and the Date it is due in Column B. Say that the current month is October, and the bill will be due on the 24th, I want it to display 10/24/15 (mm/dd/yy). I do not want to show any previous dates or current date, I only want to display the upcoming due date, and I want it to remain set on 10/24/15 until 10/25/15 where it will show me the next due date as 11/24/15, the very next month.
I need it to show the due date from 09/25/15 until 10/24/15. Then on 10/25/15 I need it to display the next due date.
UNTESTED. Please try:
=IF(DAY(TODAY())<25,DATE(YEAR(TODAY()),MONTH(TODAY()),24),DATE(YEAR(TODAY()),MONTH(TODAY()+1),24))
This solution assumes the following:
The Microsoft Excel for Mac 2011 includes the Excel function EOMONTH
The Accounts Payable Table is located at B1:D6 (adjust as required) with the following fields (see Fig. 1):
Account : Name of the payable account
Due Day : Day of the month when payment is due
Due Date : Next Payment date
Enter any of these two formulas in C2 and copy till last record
Formula 1:
=IF(DAY(TODAY())>$C3,
EOMONTH(TODAY(),0)+$C3,
EOMONTH(TODAY(),-1)+$C3)
Formula 2:
=EOMONTH(TODAY(),
IF(DAY(TODAY())>$C3,0,-1))
+$C3
I think I understand. For my example, my data is set up like this:
A B
1 Name Due Date
2 Visa 10/24/2015
For Cell B2, I have this formula:
=IF(DAY(TODAY())>=25,DATE(YEAR(TODAY()),MONTH(TODAY())+1,24),DATE(YEAR(TODAY()),MONTH(TODAY()),24))
I am assuming that you'll be opening the spreadsheet and want the month to update to the one we're currently in (hence using Today()).
Edit: To break it down -
Using =today() will return today's date in default format (pretty sure it's whatever your default format is, i.e. mm/dd/yyyy). So, using =Month(today()) will just return the month of today's date...just as Year(today()), day(today()) will return "today's year" and day, if that makes sense.
The If statement looks to see if today's numerical date is greater than or equal to 25. If it is, then return the date with today's year, today's month plus one, and the 24th. If today is less than the 25th, then return today's year, today's month, and 24 for the day.
Hopefully that helps!
edit2 - A more robust formula, allowing you to keep a separate table with the date in each month that your bills are due. Essentially, you're just replacing the "magic number" 24 with a Vlookup formula, VLOOKUP(B3,$F$2:$G$4,2,FALSE).
Here's how it works:
Instead of 'hard coding' the 24 in the formula, which you have to change every time your card changes (or you have a different due date each month), you can create a table to have these values. My range F2:G4 shows you which card is due which date. (I.e. the VISA is due on the 24th, so after the 24th, show next month). This way, you drag that formula down your "B" column, and it updates itself automatically. (See how AmEx I say is due on the 10th. But today is the 19th, so thus, we get November 10th as the due date.)
So for copying purposes, the new formula is =IF(DAY(TODAY())>VLOOKUP(B3,$F$2:$G$4,2,FALSE),DATE(YEAR(TODAY()),MONTH(TODAY())+1,VLOOKUP(B3,$F$2:$G$4,2,FALSE)),DATE(YEAR(TODAY()),MONTH(TODAY()),VLOOKUP(B3,$F$2:$G$4,2,FALSE))). (Of course, you'll need to change the ranges as necessary for your sheet).

Take me to next pay period end date?

I'm trying to create a formula that will take me to the next pay period end date.
For example, if the employee's leave of absence is going to go unpaid effective 1-1-15, I want a formula that will tell me when the last day of the pay period is for 1-1-15. We have biweekly pay periods.
Step 1: define your pay periods.
In your case, it seems pay periods are simply every other week, always on the same day of the week. You may get away with simply writing a formula that checks to see if the target date rounds into a number divisible by 14; however in the case of a holiday (which may push the payment into the prior day or the following Monday depending on holdiay), I recommend creating a list manually.
To do this, go to a new sheet (let's say Sheet2). On A1, write the date of the last pay period which just happened. Then on A2 and drag down, use the formula:
=A1+14
However, after dragging this down to the end of the year, I recommend that you go back and manually confirm that each date is appropriate (ie: are there any special cases?
Step 2
Use a lookup formula to check which pay period a date falls into. Here I'll assume a simple case, where Sheet1 A1 contains the date that an employee begins unpaid leave, and Sheet1 B1 will contain the pay period which that date falls into:
=VLOOKUP(A1,'Sheet2'!A:A,1,1)
This will look for the value in A1 on Sheet2 - if it falls on the exact day, it will spit it back to you. If it doesn't fall on the exact day, it will give you the next closest date after that [make sure this rounds the way you want; I couldn't quite get a sense of the actual response you wanted].

Resources