Solved

Convert Data

Posted on 2011-09-15
8
159 Views
Last Modified: 2012-06-27
Hi Experts,

I would like to request Experts help create a VBA code to convert all data starts with "24 to 30"  at Column A (Source sheet) into 00 to 06.

E.g. Data at cell A253 (24:19:02.00) become 00:19:02.00, data at Cell A300 (26:10:00.00) converted into 02:10:00.00, and data at cell A349 (29:52:21.00) become 05:52:21.00.

Hope Experts could help me create this feature. Attached the workbook for Experts perusal.

DataChange.xls
0
Comment
Question by:Cartillo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 10

Accepted Solution

by:
plummet earned 167 total points
ID: 36544371
Hi Cartillo

I've created a little function to do this, which I have included in your module1. It looks like this:

Function TransformTime(sTimeIn As String) As String

    Dim sNewTime As String
    Dim i As Integer
    
    Select Case Val(Left$(sTimeIn, 2))
    Case 24 To 30
        i = Val(Left$(sTimeIn, 2))
        i = i - 24
        sNewTime = Format$(i, "00") & Mid$(sTimeIn, 3)
    Case Else
        sNewTime = sTimeIn
    End Select
    
    TransformTime = sNewTime
End Function

Open in new window


I hope it's what you were looking for.

Regards DataChange.xls
0
 

Author Comment

by:Cartillo
ID: 36544419
Hi plummet,

Thanks for the code. Is that a possible to retain the data in the same column but make an alteration only at the start of the time?    
0
 
LVL 30

Assisted Solution

by:gowflow
gowflow earned 333 total points
ID: 36559179
Hi Cartillo
Pls chk the attached file and activate the button Convert Time 24-30 to 00-06 and chk results.
gowflow
DataChange.xls
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 10

Expert Comment

by:plummet
ID: 36561174
Hi Cartillo

Gowflow seems to have a good solution. I'm sorry I didn't get back to you earlier but I have been too busy to spend time on EE.

Good luck.
0
 
LVL 30

Expert Comment

by:gowflow
ID: 36565583
plummet your a gentlmen ! your solution is good as well just move it Col A instead of Col D :)
gowflow
0
 
LVL 30

Assisted Solution

by:gowflow
gowflow earned 333 total points
ID: 36585776
Cartillo
any chance to have tried any of the proposed solutions ?
gowflow
0
 

Author Closing Comment

by:Cartillo
ID: 36967365
hI,

Thanks for the help
0
 
LVL 30

Expert Comment

by:gowflow
ID: 36967891
Your welcome tks for the grade
gowflow
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question