Forum Discussion

WilliamWallace's avatar
WilliamWallace
Qrew Member
3 years ago

How should I do this calculation?

Hi Folks,
I'm having an issue with dates. I have an arrival date (Date), a departure date (Date), and total days (Numerical). I need to calculate the total number of days my widget was on site. If Departure is filled, calculate Departure - Arrival Date, then if Departure Date is blank, then calculate Todays Date - Arrival date. Maybe I have it all backwards?

I'm thinking I need something like this:??

If([Departure Date] = Blank, Today() - [Arrival Date], [Departure Date] - [Arrival Date])

I'm only a week and a half into Quickbooks, so any help would be greatly appreciated.

Thanks! 



------------------------------
William Wallace
------------------------------

2 Replies

  • Welcome to QuickBase  we are a friendly bunch here  

    You were really close  



    If(IsNull([Departure Date]), Today() - [Arrival Date], [Departure Date] - [Arrival Date])

    The IsNull function can be used in any field type EXCEPT Text. 


    to check for blank text. I use

    If(Trim(My text field))="", .......

    The Trim is in case the user just enters some spaces. 



    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • WilliamWallace's avatar
      WilliamWallace
      Qrew Member
      Mark, Thanks for the help, but I got his error and no value once applied to the the cell. Any ideas?


      AHHH HAAAAA!!!! I had to change the Days (Format) to Formula - Duration! now it works! thank you!


      ------------------------------
      William Wallace
      ------------------------------