Welcome to the most active Linux Forum on the web.
 Linux - Software This forum is for Software issues. Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

 03-10-2009, 06:52 PM #1 lothario Member   Registered: Apr 2004 Posts: 340 Rep: OpenOffice spreadsheet time function In an OpenOffice spreadsheet I have a column that is "time elapsed in seconds": 66 70 75 :: :: Is there a function that will convert this into "time elapsed (mm:ss)": 01:06 01:10 01:15
 03-11-2009, 02:19 PM #2 MensaWater LQ Guru   Registered: May 2005 Location: Atlanta Georgia USA Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO Posts: 7,831 Blog Entries: 15 Rep: Don't have OO in front of me at the moment but the concept would be pretty much the same in all spreadsheets. (Or even in a script using something like bc command: 1) Take the number and divide it by 60 rounding to 0 decimal places so it only shows you the whole number. This will give you minutes. 2) The the number and do a "modulo" function on it by 60 to get the remainder. e.g. Modulo of 70, 60 is 10 because 60 goes in once and has a remainder of 10. 3) You'd need to pad the numbers if they were less than 10 to get your formatted numbers to be say 01 and 06 rather than 1 and 6. 4) Since your original math is giving you integers you'd need to convert this to strings (text) to be able concatenate with the colon (e.g. 01:06). Each of these steps are specific "functions" in a spreadsheet. On the Excel I'm looking at I have a number in C4 like 67: In D4 I put: =round(C4/60,0) for step 1. Answer is 1 (67/60 = 1) In E4 I put: =mod(c4,60) for step 2. Answer is 7 (modulo of 67, 60) In E5 I put: =text(D4, "00") for steps 3 and 4 to convert it from integer 1 to string 01.. In E6 I put: =text(E4, "00") for steps 3 and 4 to convert it from integer 7 to string 07. In E7 I put: =E5&":"&E6 for step 4 final. Answer is 01:06. This uses built in "string math". Noted that instead of "+" used for "adding" values this uses ampersand for "adding" text. Also notice I had to quote the literal text I wanted (the colon). Of course this can actually be all combined into one formula so instead of having what I show above for E5 through E7 I could just put in E7: =+TEXT(ROUND(C4/60,0), "00")&":"&TEXT(MOD(C4,60), "00") That one formula combines all the steps into one. I broke them down above for understanding. What you need to do is find how OO does the rounding, modulo, value to text and string math. I imagine the help talks about it.
 03-11-2009, 03:54 PM #3 jlinkels LQ Guru   Registered: Oct 2003 Location: Bonaire, Leeuwarden Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE Posts: 5,195 Rep: Assume your values are in column A. Set the format in column B to MM:SS. (Format Cells, first choose 13:37:13, then change the HH:MM:SS to MM:SS) The formula you enter in B1 is: =time(0;0;\$A1) Even if A1 > 59, B1 gives the MM:SS value. jlinkels

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post newbiesforever Linux - Software 2 05-22-2008 11:59 AM zymos Linux - Software 2 03-25-2008 10:09 PM Xeratul Linux - Software 5 05-29-2007 05:34 PM hedpe Linux - Software 2 01-10-2006 07:55 AM keevitaja Linux - Software 1 11-21-2002 03:08 AM

LinuxQuestions.org

All times are GMT -5. The time now is 08:44 PM.

 Contact Us - Advertising Info - Rules - Privacy - LQ Merchandise - Donations - Contributing Member - LQ Sitemap -