# Formula to populate a field if closed date is blank

I am trying to calculate number of days between case created day to today and fill that values in Field name Created Days to today. But it should have null value or Blank if the case has Closed date populated. It should calculate only if there is no closed date in the case

The formula i have created is IF( IsClosedDate, TODAY() - DATEVALUE(CreatedDate), null)

But it seems no to do the job i required, what i have to do to get the desired result

You can use the `ISBLANK` function to check if the case has a closed date or not. The `ISBLANK` function returns `TRUE` if the expression is blank, and `FALSE` otherwise. You can use this function to create a formula field that calculates the number of days between the case created date and today only if the case has no closed date.

For example, you can use the following formula:

``````IF(ISBLANK(ClosedDate), TODAY() - DATEVALUE(CreatedDate), null)
``````

This formula returns the number of days between the case created date and today if the `ClosedDate` field is blank, and null otherwise.

Another solution is to use the `CASE` function to check the status of the case. The `CASE` function evaluates an expression and returns a value based on the result of the evaluation. You can use this function to create a formula field that calculates the number of days between the case created date and today only if the case is not closed.

For example, you can use the following formula:

``````CASE(Status, "Closed", null, TODAY() - DATEVALUE(CreatedDate))
``````

This formula returns null if the Status field is "Closed", and the number of days between the case created date and today otherwise.

• Hi Tushar, For me the first formula IF(ISBLANK(ClosedDate), TODAY() - DATEVALUE(CreatedDate), null). this worked. wherelse second one did not still showing the values on field evnthough the case is closed Nov 16, 2023 at 17:43

If ClosedDate is blank then show null, else do the calculation would look something like this:

``````IF(
ISBLANK(ClosedDate),
'',
NOW() - CreatedDate
)
``````
• i got this error Error: Incorrect parameter type for function 'IF()'. Expected Text, received Number Nov 16, 2023 at 1:41
• Created Day to today – This will count number of days to today until the case is closed. When case is closed this field should be blank. that is my requirement Nov 16, 2023 at 1:52