I have worksheet named as Correlation_Process and it contains the field of Birthdate and Age.
what i want to do is to get the age based on the birthdate i already get the age based on the birthdate using excel formula. but some of the rows returns some error like this #VALUE!
Here's my excel formula to get the age: =DATEDIF(A:A,NOW(),"y")
and Here's my date format (Month/day/year) i dont get the error shown in picture which is #VALUE! when some of the rows are showing the expected output
anyone can help?
=DATEDIF(A:A,NOW(),"y")
The formula entered into cell B2 should be this:
=DATEDIF(A2, NOW(), "y")
Copy this formula down the B column and you should have the data you want.
The general formula for DATEDIF is
DATEDIF(first_date, second_date, UNIT)
Why dont you try something like this:
=TEXT(TODAY();"yyyy")-TEXT(A2;"yyyy")
And see if it works
OK lets go back to basics and the sure fired way to snag the date. We will rip apart the date manually and then recombine it.
Start by ripping apart the date into Day, Month and Year
Day
=MID(A2,4,2)
Month
=Left(A2,2)
Year
=Right(A2,4)
Now we will want to combine those values into the DATE(year,month,day) function.
=DATE(Right(A2,4),Left(A2,2),MID(A2,4,2))
Now you will want to use that in your DATEDIF formula
=DATEDIF(DATE(Right(A2,4),Left(A2,2),MID(A2,4,2)),NOW(),"y")
This assumes your dates are in the A column starting in ROW 2. Place the above formula in B2 and copy down. This is all based on your dates being text and not serial dates.
Related
I have searched online and in forums but can´t find any solution for this.
I want to calculate date as TEXT in Sharepoint list with calculated fields.
It works to calculate well with the formula below, but it prints the date like this "2018-07-06T22:00:00Z"
=IF(ISBLANK([Contract Start]);"";DATE(YEAR([Contract Start]);MONTH([Contract Start])+[ContractLength];DAY([Contract Start])))
I have tried the following formula, and it gives me the date in the format i wish "2018-07-06" but i can´t get it to add months from column [ContractLength] to the date.
=IF(ISBLANK([ContractStarts]);””;CONCATENATE(TEXT([ContractStarts];"yyyy");"-";TEXT([ContractStarts];"MM");"-";TEXT([ContractStarts];"dd")))
So I need help with a formula that adds the specified number of months from the [ContractLength] column to the start date [ContractStarts] column in the SharePoint list, and print it as TEXT so we get the date printed "2018-07-06".
Thanks in advance!
I'm not quite sure what you mean with "calculate date as text". If you mean you want to show the result as text, not a date, then you can use this formula.
=IF(ISBLANK(ContractStarts);"";TEXT(DATE(YEAR(ContractStarts);MONTH(ContractStarts)+ContractLength;DAY(ContractStarts));"yyyy-mm-dd"))
Or, if you want the result to be a date, then this formula works fine, too, but you need to select "Date" as the data type of the calculated column and tick the button for Date only.
=IF(ISBLANK(ContractStarts);"",DATE(YEAR(ContractStarts);MONTH(ContractStarts)+ContractLength;DAY(ContractStarts)))
The screenshot below shows both formulas at work in the SharePoint list.
I am looking to create and IF function that does the following.
There is a ton of data with one column containing dates. I want and if functions that labels each row according to the following.
If date falls between 0-30 days of todays date in the past then label "GOOD" (so if todays date is 21/09/2017 then it should be labelled as "GOOD" should it falls between the dates 21/09/2017 and 21/08/2017)
If date falls between 31-60 days of todays date in the past then label "FAIR"
If date falls between 61-90 days of todays date in the past then label "ATTENTION"
If date falls between 91+ days of todays date in the past then label "CLEARANCE"
Hope someone can help.
Many thanks
Use
=IF(TODAY()-A2<31,"Good",IF(TODAY()-A2<61,"Fair",IF(TODAY()-A2<91,"Attention","Clearance")))
Column D shows the difference between today date and cell date.
Alternative Answer
Use VLOOKUP to potentially ease your future formula maintenance. In an unused location, set up a table that has your break point ranges and associated return values. For this example I used the following:
Technically speaking column G is not required, but it can be easier for some people to read.
Now assuming your dates are in Column A, you can use the following formula in B2 copying down:
=TODAY()-A2
and in C2 use the following look up formula and copy down to get your desired results:
=VLOOKUP(B2,$F$3:$H$6,3,1)
now if you are not keen on generating the extra column for calculate the number of days, you can substitute that first formula into the second to get:
=VLOOKUP(TODAY()-A2,$F$3:$H$6,3,1)
place the above in B2 instead and copy down.
The following is an example of the first approach:
The main advantage to this approach is you can manipulate the lookup table easily changing breakpoints, wording of results etc easily without touching your formula (when done right)
if you have the potential for negative days, instead of returning an error, you could wrap the lookup formula in an IFERROR function to give a custom message or result.
=IFERROR(VLOOKUP(B2,$F$3:$H$6,3,1),"In the Future")
Assuming your data starts with A2, A3 and so on.. as below
Apply the below formula in B2 and drag down up to A8
=IF(AND(--TEXT(TODAY()-A2,"##")>=-1,--TEXT(TODAY()-A2,"#")<30),"GOOD",IF(AND(--TEXT(TODAY()-A2,"##")>=30,--TEXT(TODAY()-A2,"#")<60),"FAIR",IF(AND(--TEXT(TODAY()-A2,"##")>=60,--TEXT(TODAY()-A2,"#")<90),"ATTENTION",IF(--TEXT(TODAY()-A2,"##")>90,"CLEARANCE","FUTURE DATES"))))
I have a spreadsheet with a date column in Column A. I want to have a column where it returns TRUE if the date is before September 2016. How do I do that?
I tried this code in Excel but it wouldn't work.
=if(A1="2017","TRUE",if(month(F1)<"September,"FALSE","TRUE"))
Can anyone help me correcting this one? Thanks
I'm assuming Column A has the actual dates (ex: 3/3/2017). So your if statement (if<"September") is trying to compare text against a date, which will give you an error.
Easiest way to do this is enter 9/30/2016 in a separate cell (for this example, say Q1). Then in your formula, simply use:=A1 < $Q$1 and drag that down. It should give you T/F for the dates.
If Column A is formatted as a date, it has to be compared with a date only. If not excel will give you unexpected results.
The DATE function in excel allows you to input data in date format with Years, Months and Days. The format is below,
=DATE(Years,Months,Days)
You can try the below formula,
=A1<DATE(2016,9,30)
and drag it down throughout the range.
In Excel VBA, i'm trying to read a date from a cell. The cell contains the date in the form "dd.mm.yyyy" (I'm in Germany). What I need specifically is the month. But when trying to read the month, Excel returns "12" every time. By trying Day() and Year(), I found out that the cell is recognised as blank cell and thus only returns the date of 12/30/1899, when obviously the date is entered correctly.
So this is what I'm trying to do which doesn't work (to put it as simply as possible):
ActiveSheet.Range("K2") = Month(B2)
And there you go, I get a "12" in K2, when the date is actually 02.02.2016.
You need to understand that Excel stores dates as numbers, which are formatted to appear like dates in the current locale. The earliest date Excel can show is 1/1/1900, which is the number 1 in General format.
The date 15-July-2016 is the number 42566. That is the number of days since 1/1/1900.
To establish if a cell contains a real date, try formatting it with a different number format. Once you've established that it is a number and can be formatted as a date, you can move on to the next troubleshooting step.
You're not referencing cell B2 correctly. Try
ActiveSheet.Range("K2") = Month(ActiveSheet.Range("B2"))
I have an excel countifs formula with multiple criteria:
=COUNTIFS('Opp Data'!$E:$E,Home!$B11,'Opp Data'!$B:$B,Home!$D11)
My dates appear in column B on my Sheet OPP Data like so:
28/03/2016
21/04/2016
My lookup value in D11, D12 etc, will appear like so:
March - 2016
April - 2016
The dates will always be formatted like this.
Is there a way i can amend my countifs formula so that it recognises the month and the year as shown above from the dates in column B on my Opp Data sheet?
I have tried to get started by working on something like the below, but this doesn't work:
=COUNTIFS('Opp Data'!$E:$E,Home!$B11,TEXT('Opp Data'!$B:$B,"mmmm"),Home!$D11)
Please could someone show me where i am going wrong?
Thanks in advance
If you are willing to make your lookup table actual dates, you can use the SUMPRODUCT formula to get what you are after.
I have demonstrated in the below screenshot
Formula in F1: =SUMPRODUCT(--($A$1:$A$4=D1)*--(YEAR($B$1:$B$4)=YEAR(E1))*--(MONTH($B$1:$B$4)=MONTH(E1)))
If you really want to keep the text format you have, the following formula will work as in below screenshot:
Formula in I1: =SUMPRODUCT(--($A$1:$A$4=D1)*--(TEXT($B$1:$B$4,"YYYY")=RIGHT(H1,4))*--(TEXT($B$1:$B$4,"mmmm")=LEFT(H1,FIND("-",H1)-2)))