Home > Software design >  Why date format gets changed when I insert a date value into another cell in excel by using the 
Why date format gets changed when I insert a date value into another cell in excel by using the 

Time:06-23

Imagine a cell A1 has date 22-06-2022 In cell B1 I am entering this =""""&A1&"""" I get the result as "44735" not "22-06-2022"

CodePudding user response:

It is because the B1 cell doesn't have a 'Date' format, only the A1 cell has it. B1 cell only has the number value of the cell.

CodePudding user response:

See Date systems in Excel (1900 system).

When you enter a date, it is converted into a serial number that represents the number of days elapsed since January 1, 1900. For example, if you enter July 5, 2011, Excel converts the date to the serial number 40729.

When you see the number 44735 as 22-06-2022 in A1, this means that the cell is formatted as DD-MM-YYYY (you can check this by selecting the cell and clicking Ctrl 1).

So, instead of =A1 (returning: 44735 as an integer), you could use =TEXT(A1,"DD-MM-YY") to produce the same string from the value in a different cell.

  • Related