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