[Solved] Userdefined num format for number of days and hours

Discuss the spreadsheet application

[Solved] Userdefined num format for number of days and hours

Postby JulianR » Thu Mar 21, 2019 5:09 pm

Hi!

I want to make a custom cell format, that will show for a difference of two cells with date-time data as "X days Yh" or just "Yh" if the difference is less than 24 hours and I after some effort, the best effect i get is with this format code:

Code: Select all   Expand viewCollapse view
[>=2]##" days" "h";[>1]##"day" "h";H "h"


But when I try to insert H between " days " and "h" in the first two conditionals, the formatting stops working and cell stops showing content.
I have attached spread sheet with sample data.

Is there a way to make it work as I need?
Attachments
Days Hours Sample data.ods
(15.38 KiB) Downloaded 8 times
Last edited by JulianR on Fri Mar 22, 2019 9:03 am, edited 1 time in total.
Apache OpenOffice 4.1.1 / LibreOffice 5.3 / LibreOffice 6.0 / LibreOffice 6.2 on Windows 7
JulianR
 
Posts: 25
Joined: Mon Mar 12, 2018 9:41 am

Re: User-defined number format for number of days and hours

Postby MrProgrammer » Thu Mar 21, 2019 5:39 pm

JulianR wrote:I want to make a custom cell format, that will show for a [duration] as "X days Yh" or just "Yh" if the difference is less than 24 hours. Is there a way to make [my user-defined number format] work as I need?
No. Read section 4. Times in cells in Ten concepts that every Calc user should know.
You can display duration as days plus hours by using multiple cells or by using a formula which creates a text result.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.5 Build 9789 on MacOS 10.11.6.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
MrProgrammer
Moderator
 
Posts: 3842
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: User-defined number format for number of days and hours

Postby JulianR » Fri Mar 22, 2019 9:01 am

Thank you. Problem solved.
Apache OpenOffice 4.1.1 / LibreOffice 5.3 / LibreOffice 6.0 / LibreOffice 6.2 on Windows 7
JulianR
 
Posts: 25
Joined: Mon Mar 12, 2018 9:41 am


Return to Calc

Who is online

Users browsing this forum: jon oneill, robleyd, Zizi64 and 23 guests