Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-13-2017, 05:27 PM
leonardo.sp05 leonardo.sp05 is offline Macro or formula on Excel to Standardize dates Windows 7 64bit Macro or formula on Excel to Standardize dates Office 2013
Novice
Macro or formula on Excel to Standardize dates
 
Join Date: Feb 2017
Posts: 4
leonardo.sp05 is on a distinguished road
Default Macro or formula on Excel to Standardize dates

Hi, Guys

I really need help on this. I've been looking for an answer for a LONG time but couldn't find it. In my work, I need to sort a table on Excel using the date present on every line. The problem is that the spreadsheet I use have different layouts of dates as seen below.

2/13/2017 4:43:02 AM (MM/DD/YYYY)
02/11/2017 05:05 (DD/MM/YYYY)

I can't sort it this way because it always sort it wrongly.
What I need to do is to split cells and then concatenate them again but this is causing a lot of trouble.




Could you help me check if there's any way to do it automatically, using a macro, or at least using just a formula?

Thanks =)
Leo
Reply With Quote
  #2  
Old 02-13-2017, 05:32 PM
jeffreybrown jeffreybrown is offline Macro or formula on Excel to Standardize dates Windows Vista Macro or formula on Excel to Standardize dates Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

You could use this to extract out the date

=TRIM(LEFT(A1,FIND(" ",A1)))+0
Reply With Quote
  #3  
Old 02-13-2017, 05:42 PM
leonardo.sp05 leonardo.sp05 is offline Macro or formula on Excel to Standardize dates Windows 7 64bit Macro or formula on Excel to Standardize dates Office 2013
Novice
Macro or formula on Excel to Standardize dates
 
Join Date: Feb 2017
Posts: 4
leonardo.sp05 is on a distinguished road
Default

Sorry, I'm not sure I get it.

Here's what I have:

A1 = 2/14/2017 11:14:58 AM
A2 = 02/12/2017 12:40

Obs. I have 50 different lines, these are just examples

Can you explain to me how to do it?

Tks
Reply With Quote
  #4  
Old 02-13-2017, 05:46 PM
jeffreybrown jeffreybrown is offline Macro or formula on Excel to Standardize dates Windows Vista Macro or formula on Excel to Standardize dates Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Actually, now that I think about it, you can use Int and Mod to separate the date and time.

See if this attachment helps
Attached Files
File Type: xlsx Leonardo.xlsx (8.7 KB, 7 views)
Reply With Quote
  #5  
Old 02-13-2017, 05:52 PM
leonardo.sp05 leonardo.sp05 is offline Macro or formula on Excel to Standardize dates Windows 7 64bit Macro or formula on Excel to Standardize dates Office 2013
Novice
Macro or formula on Excel to Standardize dates
 
Join Date: Feb 2017
Posts: 4
leonardo.sp05 is on a distinguished road
Default

Thanks for your time.

Unfortunately, it is not working on dates mm/dd/aaaa.

12/02/2017 12:40 12/fev/17 12:40 PM
2/14/2017 11:14:58 #VALUE! #VALUE!
02/12/2017 12:40 02/dez/17 12:40 PM


I think the problem is that I need to convert some dates from mm/dd/aaaa in order to let all dates equal dd/mm/aaaa =/


Tks
Reply With Quote
  #6  
Old 02-13-2017, 06:00 PM
jeffreybrown jeffreybrown is offline Macro or formula on Excel to Standardize dates Windows Vista Macro or formula on Excel to Standardize dates Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Actually, part of the problem is your not giving enough samples to know the extent of your data. What was offered in post #4 works with the sample posted in post #3.

Please attach a good Excel worksheet example of all the possible scenarios contained within your data.
Reply With Quote
  #7  
Old 02-13-2017, 06:07 PM
leonardo.sp05 leonardo.sp05 is offline Macro or formula on Excel to Standardize dates Windows 7 64bit Macro or formula on Excel to Standardize dates Office 2013
Novice
Macro or formula on Excel to Standardize dates
 
Join Date: Feb 2017
Posts: 4
leonardo.sp05 is on a distinguished road
Default

Sorry.


Here it is.
On the tab Example, it is the examples os dates I have. What I need to to is to standardize them all into DD/MM/AAAA HH/MM in order to allow me sort them.


Thanks
Attached Files
File Type: xlsx Example.xlsx (19.3 KB, 9 views)
Reply With Quote
  #8  
Old 02-13-2017, 06:15 PM
jeffreybrown jeffreybrown is offline Macro or formula on Excel to Standardize dates Windows Vista Macro or formula on Excel to Standardize dates Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

For some reason, your dates in column A are not being read as dates. To see this, in B2 use =ISNUMBER(A2)

You should get FALSE as it's not a number, so we have to convert it to a number.

A couple of ways to do this:

1) In B2 use the formula =A2+0 and copy it down. Now convert column B to values and sort. The +0 forces A2 into a number.

2) Use Text to Columns

Text to Columns
  • Highlight range to convert >> Column A
  • Data >> Data Tools >> Text to Columns >> Check Delimited >> Next >> Next
  • Check Date and with the drop down select your format
  • Finish
Attached Files
File Type: xlsx Example (2).xlsx (21.0 KB, 6 views)
Reply With Quote
Reply

Tags
dates, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro or formula on Excel to Standardize dates Formula/VBA to identify order of entry dates lesmielles Excel Programming 3 02-08-2017 06:14 AM
Macro or formula on Excel to Standardize dates IF formula using dates rindelsk Excel 1 04-06-2015 01:15 AM
Macro or formula on Excel to Standardize dates IF Formula to calculate dates Sophie1 Excel 2 04-23-2014 07:19 AM
If formula for subtracting dates gbaker Excel 6 10-07-2012 07:06 AM
Excel 2007 - formula or macro/vba code required wrighty50 Excel Programming 3 05-13-2012 02:24 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:09 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft