Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by cpeters5
at 2024-08-01 06:14:07
Point:500 Replies:8 POST_ID:828653USER_ID:11535
Topic:
Microsoft Excel Spreadsheet Software;;
I have the following array of date time values
7/14/2012 20:00:00
7/14/2012 21:00:00
7/14/2012 22:00:00
7/14/2012 23:00:00
7/15/2012 00:00:00
7/15/2012 01:00:00
7/15/2012 02:00:00
How do I format it to come out as
7/14/2012 20:00:00
7/14/2012 21:00:00
7/14/2012 22:00:00
7/14/2012 23:00:00
7/14/2012 24:00:00
7/14/2012 25:00:00
7/14/2012 26:00:00
Thanks,
7/14/2012 20:00:00
7/14/2012 21:00:00
7/14/2012 22:00:00
7/14/2012 23:00:00
7/15/2012 00:00:00
7/15/2012 01:00:00
7/15/2012 02:00:00
How do I format it to come out as
7/14/2012 20:00:00
7/14/2012 21:00:00
7/14/2012 22:00:00
7/14/2012 23:00:00
7/14/2012 24:00:00
7/14/2012 25:00:00
7/14/2012 26:00:00
Thanks,
Expert: duncanb7 replied at 2024-08-01 08:50:39
Thanks for your score and
please let us know in advance you want the code in VBA code instead of Excell cell formula
Be reminded, next time, also including VBA for your next thread tag so that
other EE expert can help you in much faster way
please let us know in advance you want the code in VBA code instead of Excell cell formula
Be reminded, next time, also including VBA for your next thread tag so that
other EE expert can help you in much faster way
Author: cpeters5 replied at 2024-08-01 08:46:02
Thank yu all excel experts,
I accept the first answer that works. There are so many great information from
I accept the first answer that works. There are so many great information from
Expert: duncanb7 replied at 2024-08-01 07:31:53
Formula modification for final version, please review,
Please see attached download file from re-sending update of "data.xls" for final xls file
*******A*******************B***********C*************
1
2 7/14/2012 20:00:00
3 7/14/2012 21:00:00
4 7/14/2012 22:00:00
5 7/14/2012 23:00:00
6 7/15/2012 00:00:00
7 7/15/2012 01:00:00
8 7/15/2012 02:00:00
Put B2 formula as
=IF(ISERROR(MID(RIGHT(B1,8),1,2)*1)=FALSE,IF(B1>=23,B1+1,MID(RIGHT(A2,8),1,2)*1),MID(RIGHT(A2,8),1,2)*1)
Put C2 formula as
=IF(B2>23,MID(C1,1,10),MID(A2,1,LEN(A2)-8)) & " " & B2 & RIGHT(A2,6)
And the result will come out
*******A*******************B***********C*************
1
2 7/14/2012 20:00:00 20.00 7/14/2012 20:00:00
3 7/14/2012 21:00:00 21.00 7/14/2012 21:00:00
4 7/14/2012 22:00:00 22.00 7/14/2012 22:00:00
5 7/14/2012 23:00:00 23.00 7/14/2012 23:00:00
6 7/15/2012 00:00:00 24.00 7/14/2012 24:00:00
7 7/15/2012 01:00:00 25.00 7/14/2012 25:00:00
8 7/15/2012 02:00:00 26.00 7/14/2012 26:00:00
And if you need, please hidden B colume since it is just temporarily used
That is all, otherwise, you need VBA module if you don't like column B for temporary varible
It works completely and final
Duncan
Please see attached download file from re-sending update of "data.xls" for final xls file
*******A*******************B***********C*************
1
2 7/14/2012 20:00:00
3 7/14/2012 21:00:00
4 7/14/2012 22:00:00
5 7/14/2012 23:00:00
6 7/15/2012 00:00:00
7 7/15/2012 01:00:00
8 7/15/2012 02:00:00
Put B2 formula as
=IF(ISERROR(MID(RIGHT(B1,8),1,2)*1)=FALSE,IF(B1>=23,B1+1,MID(RIGHT(A2,8),1,2)*1),MID(RIGHT(A2,8),1,2)*1)
Put C2 formula as
=IF(B2>23,MID(C1,1,10),MID(A2,1,LEN(A2)-8)) & " " & B2 & RIGHT(A2,6)
And the result will come out
*******A*******************B***********C*************
1
2 7/14/2012 20:00:00 20.00 7/14/2012 20:00:00
3 7/14/2012 21:00:00 21.00 7/14/2012 21:00:00
4 7/14/2012 22:00:00 22.00 7/14/2012 22:00:00
5 7/14/2012 23:00:00 23.00 7/14/2012 23:00:00
6 7/15/2012 00:00:00 24.00 7/14/2012 24:00:00
7 7/15/2012 01:00:00 25.00 7/14/2012 25:00:00
8 7/15/2012 02:00:00 26.00 7/14/2012 26:00:00
And if you need, please hidden B colume since it is just temporarily used
That is all, otherwise, you need VBA module if you don't like column B for temporary varible
It works completely and final
Duncan
Assisted Solution
Expert: duncanb7 replied at 2024-08-01 07:29:14
150 points EXCELLENT
*******A*******************B***********C*************
1
2 7/14/2012 20:00:00
3 7/14/2012 21:00:00
4 7/14/2012 22:00:00
5 7/14/2012 23:00:00
6 7/15/2012 00:00:00
7 7/15/2012 01:00:00
8 7/15/2012 02:00:00
Put B2 formula as
=TEXT(IF(ISERROR(MID(RIGHT(B1,8),1,2)*1)=FALSE,IF(B1>=23,B1+1,MID(RIGHT(A2,8),1,2)*1),MID(RIGHT(A2,8),1,2)*1),"00")
Put C2 formula as
=MID(A2,1,LEN(A2)-8) &B2 & RIGHT(A2,6)
And the result will come out
7/14/2012 20:00:00 20 7/14/2012 20:00:00
7/14/2012 21:00:00 21 7/14/2012 21:00:00
7/14/2012 22:00:00 22 7/14/2012 22:00:00
7/14/2012 23:00:00 23 7/14/2012 23:00:00
7/15/2012 00:00:00 24 7/15/2012 24:00:00
7/15/2012 01:00:00 25 7/15/2012 25:00:00
7/15/2012 02:00:00 26 7/15/2012 26:00:00
And hidden B colume since it is just temporarily used
That is all, otherwise, you need VBA module if you don't like column B for temporary varible
1
2 7/14/2012 20:00:00
3 7/14/2012 21:00:00
4 7/14/2012 22:00:00
5 7/14/2012 23:00:00
6 7/15/2012 00:00:00
7 7/15/2012 01:00:00
8 7/15/2012 02:00:00
Put B2 formula as
=TEXT(IF(ISERROR(MID(RIGHT(B1,8),1,2)*1)=FALSE,IF(B1>=23,B1+1,MID(RIGHT(A2,8),1,2)*1),MID(RIGHT(A2,8),1,2)*1),"00")
Put C2 formula as
=MID(A2,1,LEN(A2)-8) &B2 & RIGHT(A2,6)
And the result will come out
7/14/2012 20:00:00 20 7/14/2012 20:00:00
7/14/2012 21:00:00 21 7/14/2012 21:00:00
7/14/2012 22:00:00 22 7/14/2012 22:00:00
7/14/2012 23:00:00 23 7/14/2012 23:00:00
7/15/2012 00:00:00 24 7/15/2012 24:00:00
7/15/2012 01:00:00 25 7/15/2012 25:00:00
7/15/2012 02:00:00 26 7/15/2012 26:00:00
And hidden B colume since it is just temporarily used
That is all, otherwise, you need VBA module if you don't like column B for temporary varible
Assisted Solution
Expert: frankhelk replied at 2024-08-01 07:18:18
150 points EXCELLENT
Thanks for your score and
please let us know in advance you want the code in VBA code instead of Excell cell formula
Be reminded, next time, also including VBA for your next thread tag so that
other EE expert can help you in much faster way
please let us know in advance you want the code in VBA code instead of Excell cell formula
Be reminded, next time, also including VBA for your next thread tag so that
other EE expert can help you in much faster way
Accepted Solution
Expert: Rgonzo1971 replied at 2024-08-01 06:41:47
200 points EXCELLENT
Hi,
You could use the formulas
=TEXT(TRUNC(A$1,0),"M/d/yy ")&TEXT(A$1+TIME(ROW(A2)-1,0,0)-INT(A$1),"[hh]:mm:ss")
in this example
Regards
You could use the formulas
=TEXT(TRUNC(A$1,0),"M/d/yy ")&TEXT(A$1+TIME(ROW(A2)-1,0,0)-INT(A$1),"[hh]:mm:ss")
in this example
Regards
Expert: byundt replied at 2024-08-01 06:37:19
AFAIK, you cannot format a date time serial number so it displays both the date and a time greater than 24 hours. As a workaround, you can convert the date time serial number to text using the formula below, but that may defeat your purpose.
="7/14/2012 " & TEXT(A1-"7/14/2012","[hh]:mm:ss")
Could you please describe the underlying problem you are trying to solve? There is likely a different approach to solve it than the one you request.
="7/14/2012 " & TEXT(A1-"7/14/2012","[hh]:mm:ss")
Could you please describe the underlying problem you are trying to solve? There is likely a different approach to solve it than the one you request.
Expert: Glowman replied at 2024-08-01 06:20:43
could you simply sort it after it comes out?
ThisWorkbook.Worksheets("mySheet").Sort.SortFields.Clear
ThisWorksheets("mySheet").Sort.SortFields.Add Key:=Range("A:A"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("mySheet").Sort
.SetRange Range("A:A")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ThisWorkbook.Worksheets("mySheet").Sort.SortFields.Clear
ThisWorksheets("mySheet").Sort.SortFields.Add Key:=Range("A:A"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("mySheet").Sort
.SetRange Range("A:A")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With