[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libreoffice-users] [Calc] Good way to turn hours+minutes into minutes?


At 05:37 17/07/2020 -0700, Gilles Noname wrote:
I have a spreadsheet where time is formatted as HHhMM. In the next column, I'd like to show this in minutes. What would be a good way to achieve this?

That depends on exactly what you have in your cells. Do you mean that you have text values or that you have numerical values formatted as, say, HH\hMM ? Partly because your image shows the values left aligned, I'm guessing that you have text values. If so, use
=LEFT(Xn;2)*60+RIGHT(Xn;2)

If there is a risk that cell values might include trailing spaces you could use
=LEFT(Xn;2)*60+MID(Xn;4;2)
or
=LEFT(Xn;2)*60+RIGHT(TRIM(Xn);2)

Note that the LEFT() and RIGHT() functions return text values, but these are implicitly converted to numerical values on the fly by the need to apply the "+" operator in the formulae.

I trust this helps.

Brian Barker


--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.