Page 1 of 1

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

PostPosted: Thu Mar 21, 2019 5:09 pm
by JulianR
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?

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

PostPosted: Thu Mar 21, 2019 5:39 pm
by MrProgrammer
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.

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

PostPosted: Fri Mar 22, 2019 9:01 am
by JulianR
Thank you. Problem solved.