Answer the question
In order to leave comments, you need to log in
How to convert minutes to hours in excel spreadsheet?
There is a large table, each cell contains a numeric value in minutes.
You need to convert minutes to hours. So that for example "1440" is converted to "24", and "150" to "2.5".
There are a lot of options on the Internet where they suggest creating a field next to it and putting a formula there. This solution is the most obvious, but completely inappropriate in this situation, because there are a lot of columns and rows.
I need to somehow apply the transformation to the selected cells once, but I can't figure out how to do it. Please help me figure it out.
Answer the question
In order to leave comments, you need to log in
Found a solution in VBA, but it's still quite a complicated approach. I think there must be some better solution.
Sub MinutesToHours()
Dim rng As Range
Set rng = ActiveSheet.UsedRange.SpecialCells(xlConstants, xlNumbers)
For Each c In rng
If c.Value >= 1 And Int(c.Value) = c.Value Then _
c.Value = Round(c.Value / 60, 1)
Next c
End Sub
Your format is wrong. The time of the table is considered days, hours, minutes is a fractional number of the day. Change the cell format and no need to fence formulas.
For example, there was a standard numeric cell format with a value of 0.24
Change it to the time of the HH:MM:SS format and get 05:45:36 Change
to the time of the HH:MM format and get 05:45
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question