converting numbers to time

iosiflupis

New Member
Joined
Jan 26, 2022
Messages
39
Office Version
  1. 365
Platform
  1. Windows
Hello all,

I have run up against a wall. I am trying to convert a 4-digit number to time. I have 4 columns; Sched Dep Time, Act Dep Time, Sched Arr Time, and Act Arr Time. The two Sched columns have times in every cell in the row in the files that I am running the query on. The two Act Arr columns might not have time in a cell, as this indicates that the flight was canceled. When I load and start transforming the data it is pulled in as "null".
The steps that I am applying are:
1. Change type to text and replace values (null to "0000")
2. Split the column by the number of characters (once, as far right as possible)
3. Change the type back to number
4. Merge Columns with a colon as a delimiter
5. Change the type to Time

This is working for the first three columns, Sched Dep Time, Act Dep Time, and Sched Arr Time. However, when I repeat the process for the column Act Arr Time I get an error [Expression.Error] We couldn't parse the input provided as a Time value. This ONLY happens on the Act Arr Time column. Could someone please tell me what I am doing wrong here?

I did ask for help yesterday on how to remove specific characters in specific cells. I received an answer but couldn't understand where to insert it.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
It's not obvious to me how you process the data.
As you mentioned null values - it most often (nowadays) means you are using Power Query (Get and Transform Data).
If that's right, you can add "transformed time" column as a conditional column with the condition if column to be transformed is null then #time(0, 0, 0) else your transformationUse such approacho for all input columns, then delete input columns and keet only "transformed time" columns
 
Upvote 0
Kaper,

I tried, but I am going to guess that my lack of knowledge and failure to give information may be causing the failure. The original column is a 4-digit number without leading zeros. If I try to change to time type I get Errors. I am gonna sit back, contemplate my navel and think about whether I need the time data at all.

Thank you for the help
 
Upvote 0
Don't give up that easily. Obviously it would be easier to answer if one can see the data itself in a workbook. This forum does not offer such service but other forums (like excelforum.com) do. If you publish the same question on other forum, please remember to post also a lint to this thread (crossposting rule). You may also save (anonymized) file to some public file hosting services
 
Upvote 0

Forum statistics

Threads
1,224,847
Messages
6,181,315
Members
453,032
Latest member
Pauh

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