Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 311983 to 19830101 (YYYYMMDD)

On 13 Sep 2005 11:25:04 -0700, "tom" wrote:

Here's one that I cannot figure out.

A range contains DOB cells that currently look like this:
MonthDayYear
So, for example a cell contains 311983, and we, by process of reason,
know that the date is March 1, 1983.

I need to change this so that the cells end up with a YYYYMMDD value,
always with 8 characters. The above cell should end up with a value of
19830301.

What is the process by which I would write a VBA routine that moves the
last four characters to the front of the value, and adds 0's in the
appropriate place?

Thanks for your help.

-tom


You can't do it unless you resolve the ambiguity by requiring two digit dates.

In other words, if your range shows 3011983 instead of what you have, then it
is possible:

=--TEXT(A1,"00\/00\/0000")

and format the cell as Format/Cells/Number/Custom Type: YYYYMMDD

or use this formula (which returns a TEXT value):

=TEXT(--TEXT(A1,"00\/00\/0000"),"yyyymmdd")


--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I change MMDDYY to YYYYMMDD? mhayes Excel Discussion (Misc queries) 2 April 21st 10 11:11 PM
Date problem YYYYMMDD Hilco van Olst Setting up and Configuration of Excel 1 July 7th 08 04:39 PM
date in the form of yyyymmdd kang New Users to Excel 2 October 11th 07 05:19 PM
Formatting a date as yyyymmdd + ## Steve Excel Worksheet Functions 6 August 24th 07 04:06 PM
yyyymmdd date format German Velasquez Excel Programming 11 November 30th 04 02:42 AM


All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"