4

So I have a long list of dates that I need to add single quotations around.

However I cannot figure how to add the quotes around the date. I've looked up for help but most were using double quotations.

Example:

8/13/2018 into '8/13/2018'

Some Possible solutions I've found similar are

=TEXT(A1,"\""dd/mm/yyyy\""")

produces output: "8/13/2018"

However this only puts double quotations around the date.
The usual method I've been using on everything else is

="'"&8/13/2018&"'"

output: '43325'

But this does weird things with the date.

It would be greatly appreciated if anyone can show me how to add single quotation marks around a date in Excel.

CDspace
  • 2,639
  • 18
  • 30
  • 36
Weisheng Wu
  • 1,381
  • 2
  • 8
  • 10
  • 1
    `="'"&TEXT(c2, "dd/mm/yyyy")&"'"` – ISAE Aug 13 '18 at 21:10
  • 1
    First if all, Excel date is the number of days past from 1900.01.01 as far as I remember. Thus it is a number. Anyway why can't xou add singlevquotes with TEXT? – ZorgoZ Aug 13 '18 at 21:11
  • Thank you so much for the quick response! Appreciate your help. – Weisheng Wu Aug 13 '18 at 21:12
  • 2
    Yeah I didn't realize I need to turn the date into text format! What a great community to be in! – Weisheng Wu Aug 13 '18 at 21:13
  • 1
    There may also be a special way to import the date to sql without converting it to a string. I am not a sql user so I could be mistaken. – Forward Ed Aug 13 '18 at 21:19
  • @ZorgoZ You should add it as an answer. Since it actually solved OP's problem – Jorge Campos Aug 13 '18 at 21:31
  • @forward-ed Yes it’s possible, but there’s no indication from OP that the Excel data will actually be queried from SQL. Perhaps just building the query itself which I do myself when too lazy to use regex. – alans Aug 13 '18 at 22:57

2 Answers2

4

commenter was close but not 100%

="'" & TEXT(A1,"mm/dd/yyyy") & "'"

8/13/2018 is month day year not day month year

enter image description here

learnAsWeGo
  • 2,252
  • 2
  • 13
  • 19
0
="'" & TEXT(A1,"dd-mmm-yy")

dd-mmm-yy can be formatted as needed ex. mm/dd/yyyy etc...

excel column screenshot

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103