I need a date field changed into a text field of YYYYMMDD

Microsoft Excel 010 - complete package
March 31, 2012 at 21:32:10
Specs: Windows 7, Pentium 4 2GHz / 4 gigs.
I need a date field changed into a text field of YYYYMMDD so for example the date of birth field is 3/17/1953 and I need that converted to 19530317 in the Excel spreadsheet. Thanks.

See More: I need a date field changed into a text field of YYYYMMDD

Report •


#1
March 31, 2012 at 22:53:55
under the format options.

Report •

#2
April 1, 2012 at 06:04:06
Why do you want it to be text?

If you use a Custom format of YYYYMMDD it will remain as a date and all of the Excel Date function will work with it.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#3
April 1, 2012 at 14:42:20
I'm having to import the data back into a Foxpro database via token based language. I'm using Excel to help create the tokenized command strings.
I was hoping that Excel would provide the tools to do so. I wasn't able to figure out how to do it in Excel so I ended up writing an external program to do it.

Report •

Related Solutions

#4
April 1, 2012 at 16:10:29
With a date in A1, this formula will display the date in the format you asked for:

=TEXT(A1,"yyyymmdd")

If you then do a Copy...PasteSpecial...Values, the formula will be replaced with the text string itself.

You could write that into a Macro.

e.g. With dates in A1:A10, the text strings will be placed in B1:B10.

Sub TextDates()
 For MyRow = 1 To 10
  With Range("B" & MyRow)
    .Formula = "=TEXT(A" & MyRow & ",""yyyymmdd"")"
    .Copy
    .PasteSpecial xlPasteValues
  End With
 Next
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

Ask Question