Hi
I have a spreadsheet in Excel that contains a C field for time-merged data
AM and PM in cell
I need to separate and insert the first time am in column D
And insert the last time PM in column E
using VBA Excel
thank you
i attach excel For Example
Hi
I have a spreadsheet in Excel that contains a C field for time-merged data
AM and PM in cell
I need to separate and insert the first time am in column D
And insert the last time PM in column E
using VBA Excel
thank you
i attach excel For Example
Last edited by aabonargis; 06-12-2019 at 12:18 PM.
Title more descriptive
Last edited by Pepe Le Mokko; 06-13-2019 at 03:06 AM.
I do not know what is the appropriate name for my topicAdministrative Note:
Welcome to the forum.
We would very much like to help you with your query, however the thread title does not really convey what your request is about.
Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).
Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.
(Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
Can you help me with the right name?
___________________________
I do not think you need VBA for this.
With a LEFT() and RIGHT() function you can also get the first and last part of a merged string.
please look at attached file for the formulas to use.
Last edited by Roel Jongman; 06-12-2019 at 12:22 PM. Reason: OP changed title so removed (other) titile suggestion
This is not the right solutionI do not think you need VBA for this.
With a LEFT() and RIGHT() function you can also get the first and last part of a merged string.
The appropriate solution is to display the AM time only in column D
The PM time is displayed only in column E
thanks
For UP
A small UDF should work:
In D2, enter:![]()
Function ChooseTime( _ ByVal TimeList As String, _ ByVal Period As String, _ Optional ByVal Delimiter As String) Dim sList() As String Dim s As Variant Dim t As Date Dim ts As Date If Delimiter = "" Then Delimiter = " " sList = Split(TimeList, Delimiter) For Each s In sList ts = TimeValue(s) Select Case Period Case "AM" If ts < TimeSerial(12, 0, 0) And (ts < t Or t = 0) Then t = ts Case "PM" If ts >= TimeSerial(12, 0, 0) And (ts > t Or t = 0) Then t = ts End Select Next s ChooseTime = IIf(t > 0, t, "") End Function
Formula:
=ChooseTime($C2,"AM"," ")
In E2, enter:Formula:
=ChooseTime($C2,"PM"," ")
Copy down.
let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source
If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE
Walking the tightrope between genius and eejit...
thank you very match
thank you for help me
If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. You may also 'Add Reputation' to those who helped. Thanks.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks