# How do I formulate IF Date Created is null, show difference from today and due date; otherwise show difference from Date Created and Due Date?

• 0
• Question
• Updated 3 years ago
I was able to get the WeekDay Sub function to work but then realized that the calculation doesn't occur when entering a new ticket because the Date Created field doesn't populate until it is saved.

Here's what I'm trying but I have a syntax error.

If([Date Created]=null, WeekdaySub([File Due Date], ToDate(Today()), WeekdaySub([File Due Date], ToDate([Date Created]))

I realize my delimiters (,) are odd here but have no idea of how to structure this.

Thanks in advance for the help!

• 0 Points

Posted 3 years ago

• 0

QuickBaseCoach App Dev./Training, Champion

• 67,780 Points
Try this

If(IsNull([Date Created]),

WeekdaySub([File Due Date], Today()),

WeekdaySub([File Due Date], ToDate([Date Created]))
• 0 Points
Thanks for the reply. Unfortunately I'm getting a syntax error with this one as well.

QuickBaseCoach App Dev./Training, Champion

• 67,780 Points
If the field type is formula numeric you would need this formula

ToDays(
If(IsNull([Date Created]),
WeekdaySub([File Due Date], Today()),
WeekdaySub([File Due Date], ToDate([Date Created])))

If that is not the problem, then please say what the syntax error is or paste it into this thread.
• 0 Points
Thanks again - it is a formula numeric field. I tried the above but the problem persists. I also added a screenshot to the original post.

QuickBaseCoach App Dev./Training, Champion

• 67,780 Points
ToDays(
If(IsNull([Date Created]),
WeekdaySub([File Due Date], Today()),
WeekdaySub([File Due Date], ToDate([Date Created]))))

I think it needs one more closing )
• 0 Points
Great - it works! Thanks so much for your help.

QuickBaseCoach App Dev./Training, Champion

• 67,780 Points
Great.  Thx for letting me know.