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

Re: [libreoffice-users] Help with formula - number conversion


On Thu, 2019-07-11 at 20:55 +0200, Harvey Nimmo wrote:
> On Thu, 2019-07-11 at 14:05 -0400, Tanstaafl wrote:
> > Hi everyone,
> >
> > I need some help with converting a number (in a text field) to a
> > different type.
> >
> > The type of number is time, and it is in the form of:
> >
> > hh:mm:ss
> >
> > I need to convert this to just minutes, rounded up, so if ss is
> > more
> > than 30 it adds another minute.
> >
> > I'm at a loss as to how to even start (I'm not a spreadsheet
> > guy)...
> >
> > I would appreciate any pointers on how to get this done...
> >
> > Thanks!
>
> You might like to try the following.
> Given that your value is in field A1 in the form hh:mm:ss
> then you can do the conversion by entering the following in another
> field
> =(HOUR(A1)*60)+MINUTE(A1)+ROUND(SEC(A1/60),0)
>
> It doesn't seem to matter if the value in A1 is in time format or
> text
> format.
>
> I'm sure there are buffs out there who could offer a more elegant
> solution, but the above seems to work all right for the cases I
> tried.
>
> Cheers
> Harvey

Sorry, Tanstaafl!

There is a slight error in the above. The formula should read
=HOUR(A1)*60+MINUTE(A1)+ROUND(SECOND(A1)/60,0)

'SEC' is the secant function. Also 'MIN' would also be wrong since it
calculates the minimum of a set of values.

Cheers
Harvey



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

Follow-Ups:
Re: [libreoffice-users] Help with formula - number conversionTanstaafl <tanstaafl@libertytrek.org>
References:
[libreoffice-users] Help with formula - number conversionTanstaafl <tanstaafl@libertytrek.org>
Re: [libreoffice-users] Help with formula - number conversionHarvey Nimmo <harvey@nimmo.de>
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.