Formula to rearrange text in a cell

Nyx2012

New Member
Joined
May 18, 2023
Messages
12
Office Version
  1. 2016
Platform
  1. Windows
Hi, I have the following date and time stamp 15/05/2023 11:25:35 which I want to rearrange to the following:
2023-05-15 11:25:35. I have tried the normal format cells route but it does not want to comply.

Please could someone assist?
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Welcome to the MrExcel board!

I have tried the normal format cells route but it does not want to comply.
I assume then that the original value is Text and not Date (Numerical). If that is so, you could try this:

23 05 18.xlsm
AB
115/05/2023 11:25:352023-05-15 11:25:35
Rearrange Text
Cell Formulas
RangeFormula
B1B1=TEXTJOIN("-",,MID(A1,{7,4,1},{4,2,2}))&RIGHT(A1,9)
 
Upvote 0
Solution
.. or would it just convert like this?

23 05 18.xlsm
AB
115/05/2023 11:25:352023-05-15 11:25:35
Rearrange Text
Cell Formulas
RangeFormula
B1B1=TEXT(A1,"yyyy-mm-dd hh:mm:ss")
 
Upvote 0
Hi Peter,

Thank you for your prompt response. I am however getting #NAME? with the provided formula :cry:
 
Upvote 0
Hi Peter,

Thank you for your prompt response. I am however getting #NAME? with the provided formula :cry:
Your profile lists Office versions including 365. Have you tried in that version?

.. or what about my second suggestion?
 
Upvote 0
Your profile lists Office versions including 365. Have you tried in that version?

.. or what about my second suggestion?
Hi Peter, I have 2016 running on my server and 365 on my local. Apologies
 
Upvote 0
Hi Peter, I have 2016 running on my server and 365 on my local. Apologies
So have you tried the first formula with 365?

If the original value is in say A1, what does the formula =ISNUMBER(A1) return?

What is your normal date format order, d/m/y or m/d/y?
 
Upvote 0
Did you want a date as a result or Text ?
And do you have more dates and do some of the change when you change the date format and not others ?
In B2 you could try the below and the format the cell the way you want to see it.

Excel Formula:
=IF(ISNUMBER(A2),
DATE(YEAR(A2),DAY(A2),MONTH(A2)),
DATE(RIGHT(A2,4),MID(A2,3,2),LEFT(A2,2)))
 
Upvote 0
So have you tried the first formula with 365? - Yes but it states there is an error with the formula

If the original value is in say A1, what does the formula =ISNUMBER(A1) return? - FALSE

What is your normal date format order, d/m/y or m/d/y? - yyyy-mm-dd HH:mm:ss
 
Upvote 0

Forum statistics

Threads
1,215,125
Messages
6,123,193
Members
449,090
Latest member
bes000

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