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. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
03-10-2009, 06:52 PM
|
#1
|
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
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
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
|
LQ Guru
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
|
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
|
|
|
All times are GMT -5. The time now is 08:44 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|