Power Query covert secs to hr-min format or mins

tigerzen

Board Regular
Joined
Mar 8, 2023
Messages
209
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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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