Convert to date - excel

How i can convert number 20020415 to date 15.04.2002. I am working in Microsoft Excel 2003?
Thanks!

If your numbers are always in the same format (i.e. yyyymmdd) then use Excel's Date function to convert your number to a date:
For example, assuming date 20020415 is in cell A1, then in cell B1 use:
=DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2))
This will make sure your number is of a date format which will make it easier to use in the future if you want to treat it like a date.
Then, using Format > Cells, select 'Date' and select the appropriate formatting option (in your case 15.04.2002).
As an aside, you can access the 'Format Cells' dialog box using the shortcut keys CTRL+1. I find this a highly useful shortcut to know.

If A1 contains a number instead of text, you can use this:
=DATE(INT(A1/10000),INT((A1-10000*INT(A1/10000))/100),A1-(100*INT(A1/100)))
This can then be formatted using Excel formatting options.

Let cell A1 contains the text 20020415.
=CONCATENATE(RIGHT(A1, 2), ".", MID(A1,5,2), ".", LEFT(A1, 4))
will produce 15.04.2002.
Afterward, if you want to store the value and not the formula you can copy and paste the value only.
Note: this method still keeps the date as text.

Related

Convert date format in excel from dd.mmm to dd.mm

I need to convert this data dd/mmm - 31.mar (March) to this format 31/03 - dd/mm using excel formula
A bit of googling would have solved your issue here.
Select cell (or range of cells).
Right click with mouse
Format Cells
Custom
Change Type: dd/mmm to dd/mm
=text([CellWithDate],"dd/mm")
is the formula you want, I think.
#Valeria:
Can't be sure I understood your problem and/or the type of solution you're looking for.
I assume you have a date in , say, cell A1 and that cell is showing the date in "dd-mmm" format.
I also assume you want that date to be shown in another cell (different from A1) in "dd/mm" format BUT without previously setting that target cell format to "dd/mm".
In case I'm right, the formula you should put in the target cell shouldo look like:
=DAY(A1) & IF(MONTH(A1)<10;"/0";"/") & MONTH((A1))
This way, if cell A1 holds "31-aug", you're getting "31/08" wherever you put that formula.
The value Excel actually stores in the cell is just its date+time serial number (whatever you're seeing is a very different question). DAY() and MONTH() do work on that value to generate day of the month and month of the year after that serial number.
Hope this helps.

How to get what excel cell is showing?

I have a strange question.
Screenshot:
From the screenshot you can see that the formula bar is showing just a single apostrophe. This is on all of the blue cells. These should be dates but all this data is coming from a excel plugin (Board)
From what I know Excel treats this cells differently i.e. everything after the apostrophe should be shown as text but here there is nothing after the apostrophe and the cells are still showing a values.
Is there a way with formula that I can get and compare this value with another cell in different worksheet?
EDIT:
If there is a way to get it as a text, could it be than converted into date format number?
EDIT 2 - SOLUTION
As per Mahesh and Jeeped comments - there was a newline character in the formula bar
If the date is preceded only by a new line and there are no other characters after the date, this will be much simpler:
=VALUE(REPLACE(A1,1,1,""))
This will give you the date value in general format (i.e., 43033), so you'll have to format it as a date.
Note: Using DATEVALUE instead of VALUE will give you the same result.
You have not confirmed the vbLF characters in the cells but try this in an unused cell to retrieve a true date.
=datevalue(trim(mid(substitute(kn1, char(10), rept(char(32), len(kn1))), len(kn1), len(kn1))))
Assuming that you are on a DMY regional format that should get you a number like 43028. Format it as a date.

Excel TEXT function doesn't work

I tried to convert a date 1130505 to excel date format 5/5/2013, I first converted it by "=19000000+1130505"(20130505) in B2, then use =TEXT(B2,"yyyy-mm-dd") but it gave me an error. Anyone knows why?
It is looking for a number in the excel date notation. i.e. (see below) if you put in the date 8/7/2013 the excel "value" of that is 41493 for which the =TEXT(B6,"yyyy-mm-dd") formula would work.
Since you've already got the date formatted you don't want excel to do any thinking so you want to use =TEXT(B2,"####-##-##")
Excel has values for dates that don't equate to the numbers concatenated, so unfortunately the "TEXT" formula isn't going to work.
My recommendation would be to use a combination of "CONCATENATE", "RIGHT", and "LEFT" functions. In this case, you'd write:
=CONCATENATE(LEFT(RIGHT(A2,4),2),"/",RIGHT(A2,2),"/",RIGHT(LEFT(A2,3),2))
It looks a bit complicated, but it's the only way I can think of to handle the ordering in your values and that leading "1".
With data in A1, in B1 enter:
=DATE(2000+MID(A1,2,2),MID(A1,4,2),RIGHT(A1,2))
Then you can format B1 (if you need a true date):
or you can use:
=TEXT(DATE(2000+MID(A1,2,2),MID(A1,4,2),RIGHT(A1,2)),"m/d/yyyy")
if you need a text result.

String formatting in Excel

I have a simple query.
How can I format the text in cells in my Workbook.
If my cell has text ABC, I want it in the format 'ABC'. Is there any formula for this?
I am using Excel 2010.
I cannot do find and replace as all the values I want to alter are unique
Edit the cell or column you need to format
choose format cell
Select Custom from the bottom
Use the formula '#' .
# represents your text
Use CONCATENATE. For example if the cell is A1 then the function would be:
=CONCATENATE("'", A1, "'")
Just to add value to lgor's answer as He's already made the point.
"#" represents the text.
Just go to format cells > custom and surround the # with two Apostrophes, like: '#' and it will work.

Changing date excel cells

I have a date cells which contain the date format with the general. I want to change its cell with the same format like other cells but the problem is if I change it then it will change the entirely format of its cell.
What I've tried so far is within this formula inside of its formatting cells
(mm/dd/yy hh:mm:ss)
But I all I want to is just using the same format like the others. Thanks
Check on the file please try to change the value and any helps will be so much helpful
https://hotfile.com/dl/157148115/5ee7808/datesample.xlsx.html
The dates are stored as text
You can use datevalue and timevalue to convert the data to a real date format
in A2, enter =DATEVALUE(A1)+TIMEVALUE(A1) to get a value you can format as you wish
"05/02/2012 16:23:53" 41031.68325
"05/02/2012 16:23:53" 41031.68325
"05/04/2012 08:17:52" 41033.34574
the value displayed in the 2nd column is the excel representation of a date/time - you can then format these how you want, or do calculations to get durations.

Resources