Error Building A String With Date and Time Formatting

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,590
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am trying to create a text string from the values in 3 cells.

Catalogue12296.xlsm
PQRST
2Lilie 206-Mar-020:06:171#NAME?
DUMP
Cell Formulas
RangeFormula
Q2:R2Q2=D2
T2T2=S2 & " - " & P2 & " [" & format(Q2,"yy-mmm-dd") & " " &R2& "]"


I am looking to achieve this string in T2

1 - Monster [06-Mar-02 0:06:17]

I am getting a #NAME error with this formula.

Note: I feel I have the value in R2 represented (formatted) wrong. It's showing as a time, 0:6:17 is 12:10:17 am. It really is supposed to represent duration, ie 0:06:17 is supposed to represent 6 minutes and 17 seconds. Please help me correct this as well if it is indeed wrong.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Use TEXT.
FORMAT doesn't exist for formulas.
Book3
PQRST
1
2Lilie 23-Mar-020:06:1711 - Lilie 2 [02-Mar-03 0:06:17]
Analysis
Cell Formulas
RangeFormula
T2T2=S2 & " - " & P2 & " [" & TEXT(Q2,"yy-mmm-dd") & " " &TEXT(R2,"[h]:mm:ss")& "]"
 
Upvote 0
Solution
I am trying to create a text string from the values in 3 cells.

Catalogue12296.xlsm
PQRST
2Lilie 206-Mar-020:06:171#NAME?
DUMP
Cell Formulas
RangeFormula
Q2:R2Q2=D2
T2T2=S2 & " - " & P2 & " [" & format(Q2,"yy-mmm-dd") & " " &R2& "]"


I am looking to achieve this string in T2

1 - Monster [06-Mar-02 0:06:17]

I am getting a #NAME error with this formula.

Note: I feel I have the value in R2 represented (formatted) wrong. It's showing as a time, 0:6:17 is 12:10:17 am. It really is supposed to represent duration, ie 0:06:17 is supposed to represent 6 minutes and 17 seconds. Please help me correct this as well if it is indeed wrong.
Does this work?

Cell Formulas
RangeFormula
Q2:R2Q2=D2
T2T2=S2 & " - " & P2 & " [" & TEXT(Q2,"dd-MMM-yy") & " " & TEXT(R2,"H:MM:SS") & "]"
 
Upvote 0
Thank you both for the solution!
If I were writing this formula in VBA, then would I use "Format"?
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top