entering date

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,565
Hi
My computer date format as following dd/mm/yyyy (as per the date below the clock on my computer).
I entered this date in an excel cell: 2019/09/08 (09 is sept). To my surprise, excel converted this date to the following

08/09/2019

Why is that?

I thought excel should not accept 2019/09/08 as a date and keep it as it is (to the left hand side of the cell) because it should be considered as string not number, since I did not follow the format of the computer date.

Thank you very much
 

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,051
Office Version
2010
Platform
Windows
Hi
My computer date format as following dd/mm/yyyy (as per the date below the clock on my computer).
I entered this date in an excel cell: 2019/09/08 (09 is sept). To my surprise, excel converted this date to the following

08/09/2019

Why is that?
I am not sure why it chose that order given your computer's setting; however, if you wish to enter dates in YEAR, MONTH, DAY order, use dashes instead of slashes and I think Excel will convert it correctly. For example...

2019-09-08
 

mohadin

Active Member
Joined
Mar 22, 2015
Messages
361
Office Version
2013
Platform
Windows
Hi, What abuot
Code:
Cells(2, 3) = Date
Cells(2, 3).NumberFormat = "yyyy/mm/dd"
 
Last edited:

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
42,884
Office Version
365
Platform
Windows
Excel is simply trying to be "helpful" it recognises 2019/09/08 as a date & converts as such.
To stop that happening, change the cell format to text before entering the date, or put an apostrophe as the first character.
 

mohadin

Active Member
Joined
Mar 22, 2015
Messages
361
Office Version
2013
Platform
Windows
Excel is simply trying to be "helpful" it recognises 2019/09/08 as a date & converts as such.
To stop that happening, change the cell format to text before entering the date, or put an apostrophe as the first character.
If so, why not:
From the format cell > Custom > Type yyyy/mm/dd
 
Last edited:

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
42,884
Office Version
365
Platform
Windows
My take is that the OP wants the value to remain as a string, rather than be converted to a date.
 

Watch MrExcel Video

Forum statistics

Threads
1,102,737
Messages
5,488,575
Members
407,647
Latest member
powellku

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top