microsoft excel courses london - converting date format

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel Training and help » microsoft excel courses london - Converting Date Format

microsoft excel courses london - Converting Date Format

resolvedResolved · Low Priority · Version Standard

Cecelia has attended:
Excel VBA Intro Intermediate course

Converting Date Format

My question sounds quite silly- I

RE: Converting Date Format

Hi Cecelia

Not a silly question at all. Your challenge is to get a the month/day/year arrangement into day/month/year this can be done using the the text functions to Left, Mid and Replace along with & for concatenation or joining together.

First you need to format the column or rows that contain the dates to a day/month/year format. The custom format for this in the type box is dd mm yyyy.

Your cell values that you want to change must be in the mm/dd/yyyy meaning your formula bar should show the value in that format

This is very import because you willl next need to convert your date into that order ie. May 15 2006 is "05/15/2006" in old format however you need it the other way around "15/05/2006".

The folowing steps take place in a seperate cells of course it coud be done as a string in VBA

First step is to use the LEFT function to extract the month ie. "05"(check your function wizard for the arguements used in this function.
This function then needs to be nested in the REPLACE function to replace where the day "15" and the day text is located by using the MID function to place it at the start.

Now you can concatenate with the "&" to rest of the date order dd/mm/yyyy using MID to exact the rest as individual components in the right order

At this stage it is still a text string. To convert it into a value that excel can recongnise as a date use VALUE to encase the whole formula in.

The whole formula is below using b4 as the cell with incorrect date format

=VALUE((REPLACE((LEFT(B4,2)),1,2,MID(B4,4,2))&"/"&MID(B4,1,2)&"/"&MID(B4,7,6)))

I hope this has been of assistance

Regards


BEST Training

RE: Converting Date Format

Many thanks, very clear and helpful indeed!


 

Excel tip:

Using Alt in Save Dialog Box

When you are saving (or opening) a file, try these;
(Note the numbers are on the keyboard not the numeric keypad)
1. Go to previous folder Alt+1
2. Go up one folder level Alt+2
3. Search the Web Alt+3
4. Delete selected file Alt+4 or Delete
5. Create a new folder Alt+5
6. Cycle through all views Alt+6 repeatedly
7. Display the Tools menu Alt+7

View all Excel hints and tips


Server loaded in 0.72 secs.