Reputation: 21
I have a column in excel in hhmm format. Note that there is no ':' in the middle. Also they are not zero padded. For example 620 is 6:20 AM. 1820 is 18:20 or 6:20 PM. How do I convert this column into minutes. My intention is to subtract two such columns to obtain the time difference in minutes.
Upvotes: 0
Views: 451
Reputation: 16908
You can perform some transformation in Power Query Editor for your purpose as stated below-
Let your data looks like below-
Here is Advanced Editor code for new steps-
let
//Your existing code,
#"Split Column by Position" = Table.SplitColumn(#"previous_step_name", "time_in_number", Splitter.SplitTextByPositions({0, 2}, true), {"time_in_number.1", "time_in_number.2"}),
#"Merged Columns" = Table.CombineColumns(#"Split Column by Position",{"time_in_number.1", "time_in_number.2"},Combiner.CombineTextByDelimiter(":", QuoteStyle.None),"Merged"),
#"Changed Type2" = Table.TransformColumnTypes(#"Merged Columns",{{"Merged", type time}})
in
#"Changed Type2"
Here is the final output-
Upvotes: 0
Reputation: 11968
Formula:
=INT(A1/100)*60+MOD(A1,100)
converts your timevalue into minutes
Upvotes: 1