A
A
Alexander Balya2021-10-05 15:46:20
excel
Alexander Balya, 2021-10-05 15:46:20

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".

615c48919da86027905842.png

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

2 answer(s)
A
Alexander Balya, 2021-10-05
@Balya

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

T
tifac, 2021-10-05
@tifac

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 question

Ask a Question

731 491 924 answers to any question