Excel will not read date - excel

I've tried a million things to get Excel to read a date that is being pulled by this formula:
=(LEFT(VLOOKUP(C7,'Input Engagement Status'!C:M,9,FALSE),11))
I use LEFT because the cell I'm referencing is storing two dates simultaneously. The output is "mmm dd yyyy".
I have tried text to columns, but the formula is being pulled apart rather than the date that it reads for.
I have tried custom formatting to create a new date format for "mmm dd yyyy". I have changed from general, to numbers, to text, and I am out of solutions at this point. Any help would be greatly appreciated.

A way to illustrate the differences is with a date on the worksheet. Excel treats dates as 1 for every day past Dec 31, 1899. Today happens to be 42,192 (or 42192 as Excel sees it).
If you put =TODAY() in a cell (e.g. A1) and use =RIGHT(A1, 2), the A1 cell probably shows 07/07/2015 but the underlying value is 42192 so the RIGHT(A1, 2) is going to return 92. Format the cell so it displays Tuesday, July 7, 2015 and RIGHT(A1, 2) is still going to return 92.
If you have two dates in the same cell separted by a space or other delimiter as a text string then you should be able to pull the first 11 characters from the string value and convert it back to a date with the DATEVALUE function.
Using this data in a single cell (A1):
Jul 07 2015 Jul 15 2015
Use the SUBSTITUTE function to insert a comma so that DATEVALUE will resolve the date correctly.
=DATEVALUE(SUBSTITUTE(LEFT(A1, 11), " 20", ", 20"))
=DATEVALUE(SUBSTITUTE(RIGHT(A1, 11), " 20", ", 20"))
Format the result as a date. The above will return 42,192 and 42,200 (the number of days since Dec 31, 1899). Format as a date to get something like 07/07/2015 and 07/15/2015.
You should be able to transcribe your VLOOKUP function into that simple example.

Related

Contenate while keeping leading zero

I have an Excel spreadsheet in which the date of certain events is stored in three columns: year, month, and day.
Year
Month
Day
1734
04
08
1750
11
10
I set the format of the cell to 'custom' so as to show the leading '0' which I want to maintain. I now want to concatenate the information in these cells so that it shows the date as follows YYYY-MM-DD. I'm using this formulate to achieve that:
=CONCAT(B2, "-", C2, "-", D2)
Annoyingly, however, it doesn't maintain the leading zero (the result is: 1734-4-8 and 1750-11-10, respectively). Does anyone know how to concatenate the data from these cells while maintaining the leading zero?
Cell formatting only changes appearance, but doesn't alter value. Even if it looks like 04 it still is 4 as value.
Use TEXT:
=CONCAT(B2,"-",TEXT(C2,"00"),"-",TEXT(D2,"00"))
or
=TEXTJOIN("-",,B2,TEXT(C2,"00"),TEXT(D2,"00"))

Convert text date/time to as date time format in excel

Data is extracted from the application. There is a text representation of data/time as
"Wed Nov 30 2022 09:30:00 GMT+0530 (India Standard Time)" (in text)
I am required to format this column as MS data/time type, instead of text
First:
Tried custom format.. but didn't work.
not able to teach "Wed" and "GMT..." part
Second:
Tried to break the words as
=MID(A1,5,20) [it gives "Nov 30 2022 09:30:00" ]
and then apply.
=TIMEVALUE(TEXT(RIGHT(B1,8),"HH:MM:SS"))
It worked and excel was able to understand it in time format as9:30:00 AM
But, when I applied similarly the Date format as
=DATEVALUE(TEXT(LEFT(B1,11),"mmm dd yyyy"))
It gave a Value error, not sure what to do next
Finally:
Is there a way to do it in one go?
the entire column can be formatted as a valid date and time.
I took inspiration from:
[question]: Convert text date/time to a real date time in excel
[blog]: https://support.microsoft.com/en-us/office/format-numbers-as-dates-or-times-418bd3fe-0577-47c8-8caa-b4d30c528309
Kindly advise
There are many ways to do it, perhaps for now, I have tried this one,
• Formula used in cell B1
=LET(_string,TEXTSPLIT(MID(A1,5,20),," "),
_date,DATE(INDEX(_string,3),MONTH(INDEX(_string,1)&1),INDEX(_string,2)),
_time,TIMEVALUE(INDEX(_string,4)),
_date+_time)
Another way,
• Formula used in cell C1
=DATEVALUE(SUBSTITUTE(LEFT(MID(A1,5,20),11)," ",", ",2))+RIGHT(MID(A1,5,20),8)+0
DATEVALUE() wrapping not required actually,
• Formula used in cell C1
=SUBSTITUTE(LEFT(MID(A1,5,20),11)," ",", ",2)+RIGHT(MID(A1,5,20),8)
Use LET() to make it more readable,
• Formula used in cell C1
=LET(_extract,MID(A1,5,20),
_datepart,LEFT(_extract,11),
_timepart,RIGHT(_extract,8),
SUBSTITUTE(_datepart," ",", ",2)+RIGHT(_timepart,8)+0)
One more sleek way is using TEXTBEFORE() & TEXTAFTER()
• Formula used in cell D1
=SUBSTITUTE(TEXTBEFORE(TEXTAFTER(A1," ")," GMT")," ",", ",2)
Note: Since in Excel Date and Times are stored as number this will return as a number, The integer portion of the date serial number represents the day, and the decimal portion is the time, hence format it accordingly as per your need or regional settings.

How to auto populate the next week in excel

I am making an on-call schedule in excel and I can't for the life of me find an easy way to populate the dates. For example, someone is on call from Monday to Sunday, January 2nd - January 8th. Then the next person is on call from January 9th - January 15th. I am trying to figure out a way or formula to just "Drag" down the column and it input the next 7 day range. I have tried input the start date and end date in a separate cell, then using concatenate but it returns the date number in excel (forgot what its called). I also tried =(A1&" - "&B1) but that returns the same 5 digit number.
Any help or pointers are greatly appreciated!
Previous date + 7
If you have genuine dates, say in cells A1 "start date" and B1 "end date":
Jan 2 Jan 8
Then the next line will be
=A1+7 =B1+7
Verify Dates
To see, if the "Dates" you entered are realy dates excel can work with like that, apply "General formatting" to the A1 and B1 cells. If the resulting value is an Interer or a Decimal number, you are golden. If the resulting value did not change, you have a text and you need to apply different approach.
Perhaps you are looking for this:
=TEXT(A1,"d-mmm")&" - "&TEXT(B1,"d-mmm")
The formatting specification can be copied from the formatted cell properties.

Formula to convert quarter-year to MM/DD/YYYY in Excel

I want to convert a column of dates in QTR/YR format to MM/DD/YYYY format, using the first day of the quarter (the first days of the four quarters are Jan. 1, April 1, July 1 and Oct. 1.) How can I go about doing this?
Example:
4Q14 should become 10/01/2014
3Q14 should become 7/01/2014
2Q14 should become 4/01/2014
and so forth.
Try this:
=Date(Right(A1,2)+2000,CHOOSE(Left(A1,1),1,4,7,10),1)
If cell A1 contains the text, then
=DATE(2000+RIGHT($A$1,2),-2+3*LEFT($A$1,1),1)
is one way. That will yield a number that you can format as a date, using the format of your choice.

Excel - Convert a range of text to dates in a formula

The two columns in my data referred to in this formula are "Carrier" and the other column is "OriginalEffectiveDate". The second column consist of a range of dates over a two year span. I need to show a like count of carriers for both years.
So if the range of dates is Jan 1, 2014 to July 12, 2015 then I only want to count the carriers in 2014 up to July 12, 2014. So in other words; if I counted all of 2014 compared to just a portion of 2015 then my numbers would be off.
The results would be something like:
2014 = 343 (Jan 1 - July 12, 2014)
2015 = 375 (Jan 1 - July 12, 2015)
When I set the file up originally the data I was using was static and the dates were numeric fields. When I took the same file and made the connection directly to the database the dates are now coming in as text and I cant get the same formula to work.
Thanks in advance for your help.
=COUNTIFS(tbl_Group[Carrier],A5,tbl_Group[OriginalEffectiveDate],"<="&EDATE(MAX(tbl_Group[OriginalEffectiveDate]),-12))
Photo:
Can you add a calculated column to your table?
If so, try this: add column called CalculatedDate with formula =DATEVALUE([#OriginalEffectiveDate])
Your CountIfS formula becomes
=COUNTIFS(tbl_Group[Carrier],A10,tbl_Group[CalculatedDate],"<="&EDATE(MAX(tbl_Group[CalculatedDate]),-12))
Note: DATEVALUE will make assumptions about potentially ambiguous dates, in my case yyyy-mm-dd based on my regional settings.
The reason COUNTIFS can't work without a calculated column is that the criteria_range parameters must be a direct range, and tbl_Group[OriginalEffectiveDate] are strings, not dates.
An alternative formula that doesn't require a calculated column is
=SUMPRODUCT(
(tbl_Group[Carrier]=A12) *
(DATEVALUE(tbl_Group[OriginalEffectiveDate]) <=
MAX(EDATE(DATEVALUE(tbl_Group[OriginalEffectiveDate]),-12))
)
)

Resources