Power Query covert secs to hr-min format or mins

tigerzen

Board Regular
Joined
Mar 8, 2023
Messages
165
Office Version
  1. 365
Platform
  1. Windows
Downloaded data comes with several columns in seconds format eg 8000 secs, can it be cleaned up quickly via Power Query so that the columns containing secs reads 2 hr 13 m or simply 133 mins. I have been tackling this by creating a custom formula for each column and then dividing by 60 but this gets a bit tedious when there are 10 or more columns in seconds.
 

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)
Just realised that this should have been posted in another section, apologies.
 
Upvote 0
Hi,
You can test
VBA Code:
let
    Source = #table(type table[Seconds = Int64.Type],{{5276}, {12675}, {76538}}),
    #"Added Custom" = Table.AddColumn(Source, "Time", each #time(0,0,0) + #duration(0,0,0,[Seconds]), type time)
in
    #"Added Custom"
 
Upvote 0
Thanks James, that's really close. I will need to perform calculations on these values so can your query be modified so that it converts the field/columns to mins, eg the first entry which reads 5276 is simply changed to 87.9 (mins) or 88. Once it has been converted the original column with seconds is no longer required. I had thought that possibly all the columns containing seconds data could be converted directly into mins but maybe the custom columns are required and once set up the original columns with seconds could be removed.
 
Upvote 0

Forum statistics

Threads
1,215,339
Messages
6,124,363
Members
449,155
Latest member
ravioli44

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