Skip to main content

Hello, I have this formula, but the result is always in hours. Where is the error?

Thanks
Fabio

 

 

IF( Stato = "Campagna", IF( DATETIME_DIFF(NOW(), Chiusura, 'hours') > 48, DATETIME_DIFF(NOW(), Chiusura, 'days') & " giorni", IF( DATETIME_DIFF(NOW(), Chiusura, 'hours') < 48, DATETIME_DIFF(NOW(), Chiusura, 'hours') & " ore", IF( DATETIME_DIFF(NOW(), Chiusura, 'hours') < 8, DATETIME_DIFF(NOW(), Chiusura, 'minutes') & " minuti" ) ) ) )

 

 

Hmmm. I think you might have one too many IF statements. I’m on mobile so I’m going to paraphrase your formula:

If DATETIME_DIFF>48 hours, days, if DATETIME_DIFF>8 hours, hours, minutes.

Also, your username is fantastic!


Thank you for your reply! In the meantime, I have found the solution (thanks ziotitanok!). The problem was that, due to how I wrote the formula, I was getting a negative result, and as a consequence, the various IF statements couldn't work. Now, I have reversed DATETIME_DIFF(NOW(), Chiusura) to DATETIME_DIFF({Chiusura}, NOW()), and the formula works. I could have inverted the operators and used a negative number, but I prefer having a positive result.