Currently I am trying to get my Excel spreadsheet to update the age of people as the dates come around. For example, this year I am 20 years old and my birthday is 03/03/1994. I want Excel to be able to change my age to 21 on 03/03/2015 and change it to 22 on 03/03/2016.
I was thinking a formula that involves taking the date of birth and subtracting it from the current date but I don't know how to get excel to update that current date.
This is so that I don't have to go in and change each person's age whenever they have a birthday.
The simple answer to your question is =now() or =today()
However there is a formula in excel called =DATEDIF() (literally date dif ference)
This takes three arguments (in context):
Past Date/Birthdate
To Date/Today
Interval Type (full years in this case)
So the formula can be written like this:
=DATEDIF(DATEVALUE("01/01/2001"),TODAY(),"y")
This gives you an answer in whole calendar years
You could of course replace DATEVALUE("01/01/2001") with a cell reference
=DATEDIF(VALUE(A1),TODAY(),"y")
Pick a cell and enter:
=DATEDIF(DATEVALUE("3/3/1994"),TODAY(),"y")
Related
I have a excel spreadsheet with two columns. One with a date and another with the value.
I want to get the working day of the month with the lowest value.
I tried to use a pivot table for it and then group the date but I get a lot of errors.
You can find the spreadsheet here and the sheet name is Historical. The others are just attempts made by me.
Spreadsheet
Thanks
The formula entered in E2 below
is
=AGGREGATE(15,6,(POWER(10,LOG10(((YEAR(D2)=YEAR($A$2:$A$3254))*(MONTH(D2)=MONTH($A$2:$A$3254)))))*$B$2:$B$3254),1)
and the array formula entered in F2 below is
=INDEX($A$2:$A$3254,MATCH(YEAR(D2)&MONTH(D2)&E2,YEAR($A$2:$A$3254)&MONTH($A$2:$A$3254)&$B$2:$B$3254,0))
I suggest to make an triple nested if-construct that checks if the weekday of the date is a workday, or the date+ 1 or the day +2. Assuming the date is in cell A4
= if(instr(weekday(A4),”23456”)>0, A4,
if(instr(weekday(A4+1),”23456”)>0, A4 + 1,
if(instr(weekday(A4+2),”23456”)>0, A4 + 2,”cannot happen”)))
Explanation: one of 3 consecutive days is always a working day.
There may be typos since I edit that on iPad without Excel available to test.
Weekday returns 1 for Sunday and 7 for Saturday. So 2-6 are workdays.
However with that simple approach you will not detect public holidays on a working day if that is a problem.
Hope I understood you question correctly. One data example with solution would have explained it better.
Hello I am trying to use a simple excel sheet (last name, first name, date of birth, date of hire) for an employee listing to then create a list of birthdays (pro[bably +/- 7 days) - just the last & first name. Secondly the same thing for the hire date (probably +/- 14 days) and the years of service, that calculation I figured out easily.
I was trying to do this with if statements or datedif and am struggling.
maybe this isnt the proper tool, any thoughts, suggestions would be greatly appreciated!
Please see sample data screen shot below:
expected output:
Maybe this would be better as a vlookup?
Thank you
OK, so here is what I came up with based on my understanding of the question:
=IF(OR(DATEDIF(B2,TODAY(),"YD")<=7,DATEDIF(B2,TODAY(),"YD")>=359),A2,"NO")
The formula here takes number of days between the birthday and today (ignoring the years) and checks if they're less than or equal to 7 or more than or equal to 359.
Sample spreadsheet: https://www.dropbox.com/s/kxgi9eeoikems66/Birthday.xlsx?dl=0
Insert two more columns for month of birth and month of hiring. Add the following formula in both consecutively
=TEXT(C1,”MMMM”) and =TEXT(D1,”MMMM”)
The final sheet will look like this
After that select all of your data and insert Pivot table and format it like the below
You will get an auto updatable sheet without any macros and extra work
This is a follow up to the earlier question.
The only differences between the original formula & the one that is causing a problem is location AC3 is a static date & location S2 is dynamic. S2 houses a dynamic formula that allows for a leap year:
=DATE(YEAR(Q3)+1,MONTH(Q3),DAY(Q3-1))
Location Q3 refers to a basic date formula:
=TODAY()
I hope this helpful.
Change your formula in S9 to:
=Date(year(s2),1,S8)
The reason for this is Date is looking for 3 integers to be passed to it. What you did was pass it a date in the place of a year number that really did not make sense to excel. What you needed to send is:
=Date(2016,1,22)
What you sent was:
=Date(5/5/2016,1,22)
or more accurately
=Date(42496,1,22)
42496 is how excel stores a date. What the year function does is strip the year part of the date and return it as an integer.
=Year(5/6/2016)
this really equates to
2016 'an integer
Hope that clarifies some things.
When you have all your formulas condensed down to a single cell and pointed at one year, consider arranging them as follows:
or
You should only need row 3 or row 4, which ever you prefer. Also once you have one column of holidays set up, you should just be able to copy them to the right.
I have a date in the format of "4/26/2013". I want to see if that date is prior than the current year, whatever that current year may be (don't want to hardcode 2013) and count how many of the rows match that criteria. Say there are 6 rows of dates in that format:
=COUNTIF(C2:C7, YEAR(Today()))
This threw an error. I'm new to Excel, so I probably made a huge mistake! Can anyone see what is wrong with this?
Thanks!
If C2:C7 contain dates you need to compare them to the 1st of January in the current year, e.g.
=COUNTIF(C2:C7,"<"&DATE(YEAR(TODAY()),1,1))
or you can use SUMPRODUCT like this
=SUMPRODUCT((YEAR(C2:C7)<YEAR(TODAY()))*(C2:C7<>""))
I just figured it out. My syntax was wrong. The answer to the above example was:
=COUNTIF(C2:C7, ">"&YEAR(TODAY()))
That returned the number of dates in C2 - C7 that were prior to the current year.
So I have a cell with 7/6/2012 10:26:42 inputted, I want to show the date difference from today in another cell.
I tried to extract 7/6/2012 with =LEFT(A1, Find(" ", A1, 1) -1) but turned out theres a value error.
The formula works when I make A1 '7/6/2012 10:26:42, however it is not ideal because I have to work with the whole column.
You can use the datedif function to find out difference in days.
=DATEDIF(A1,TODAY(),"d")
Quote from excel.datedif.com
The mysterious datedif function in Microsoft Excel
The Datedif function is used to calculate interval between two dates in days, months or years.
This function is available in all versions of Excel but is not documented. It is not even listed in the "Insert Function" dialog box.
Hence it must be typed manually in the formula box.
Syntax
DATEDIF( start_date, end_date, interval_unit )
start_date from date
end_date to date (must be after start_date)
interval_unit Unit to be used for output interval
Values for interval_unit
interval_unit Description
D Number of days
M Number of complete months
Y Number of complete years
YD Number of days excluding years
MD Number of days excluding months and years
YM Number of months excluding years
Errors
Error Description
#NUM! The end_date is later than (greater than) the start_date
or interval_unit has an invalid value.
#VALUE! end_date or start_date is invalid.
If that's a valid date/time entry then excel simply stores it as a number (days are integers and the time is the decimal part) so you can do a simple subtraction.
I'm not sure if 7/6 is 7th June or 6th July, assuming the latter then it's a future date so you can get the difference in days with
=INT(A1-TODAY())
Make sure you format result cell as general or number (not date)
For the difference between A1 and Today's date you could enter:
=ABS(TODAY()-A1)
which returns the (fractional) number of days between the dates.
You're likely getting a #VALUE! error in your formula because Excel treats dates as numbers.
DAYS(start_date,end_date):
For example:
DAYS(A1,TODAY())
Why don't you just make it easy and simple. If I need to know the number of days between today and say, March 10th, 2015, I can just enter the simple formula.
Lets say the static date is March 10th, 2015, and is in cell O5.
The formula to determine the number of days between today and O5 would be, =O5-Today()
Nothing fancy or DATEDIF stuff. Obviously, the cell where you type this formula in must have a data type of 'number'. Just type your date in normally in the reference cell, in this case O5.
=ROUND((TODAY()-A1)/365,0) will provide number of years between date in cell A1 and today's date
*In all instances the # refers to the cell number
You really don't need the datedif functions; for example:
I'm working on a spreadsheet that tracks benefit eligibility for employees.
I have their hire dates in the "A" column and in column B is =(TODAY()-A#)
And you just format the cell to display a general number instead of date.
It also works very easily the other way: I also converted that number into showing when the actual date is that they get their benefits instead of how many days are left, and that is simply
=(90-B#)+TODAY()
Just make sure you're formatting cells as general numbers or dates accordingly.
Hope this helps.