MID function not working

mswaf01

New Member
Joined
Aug 7, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
I need to cut a long column of cells (millions) quickly. The current data displayed in the cell its date and time, displayed in a custom format of dd/mm/yy hh:mm

I need to quickly cut this in a new column that only contains the hour. However, the MID function isn't working for this:
1691409365229.png
. I have also tried this using MID and LENS together.

I think the problem is that the DATETIME is in a custom format rather than general, but when I convert to general it reverts to a series of seemingly unrelated numbers, e.g.:
1691409444614.png



What do I need to do to be able to extract only the hour data?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi & welcome to MrExcel.
when I convert to general it reverts to a series of seemingly unrelated numbers
That's exactly what should happen, a date is just a number with special formatting where 1 is the 1st Jan 1900.
As they appear to be genuine dates & times try
Excel Formula:
=hour(c6)
 
Upvote 0
Hi & welcome to MrExcel.

That's exactly what should happen, a date is just a number with special formatting where 1 is the 1st Jan 1900.
As they appear to be genuine dates & times try
Excel Formula:
=hour(c6)
Thanks, that's worked brilliantly! (I didn't know that was a function).

I've got a new problem now....about halfway down my spreadsheet the formula stops working. I think its because the format of the DATETIME cells is obviously suddenly different, but when I try to change it to the same as the other cells it doesn't work and just stays the way it is?
1691410203292.png
 
Upvote 0
The rows where you get the #value error are text & not real dates/times. Where is this data coming from?
 
Upvote 0
The rows where you get the #value error are text & not real dates/times. Where is this data coming from?
Its data provided to me from an independent source that collected it.
 
Upvote 0
What is SPSS?
It's just another processing programme- it shouldn't be the cause of the problem. I just used it to split the file in half so it could be opened in Excel without data loss.
 
Upvote 0
It may well be the problem as it could be causing the dates to change to text.
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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