function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hemant ranahemant rana 

one value is subtracted as each day passes in formula field

hi i have two fields-
"Days Needed"-- Manual Entry
"Days Remaining"-- Should be a formula field in which when each day passes it subtract 1 from "Days Needed" and populate the value and stop when it is 0.
  let say "Days Needed" field has value-2 and today is 30th . on 31st the value in "Days Remaining" should be-1 and on 1st value on "Days Remaining" should be 0;
Best Answer chosen by hemant rana
Chidambar ReddyChidambar Reddy
Hi Hemanth,

Create custom field 'End Date' with data type DATE

Write a workflow field update on this object, entry criteria should be ISCHANGED(DaysNeeded__c) and
update 'End Date' field with 'Today()+DaysNeeded__c' in field update formula

Create a formula field 'Days_Remaining__c' with return type Number

EndDate__c-Today()

You can add condition that when it is greater than 0 then only populate

Make sure that field update should run only when you change 'days needed'



Thank you 
Choose it as best answer if it resolves your issue.

All Answers

Chidambar ReddyChidambar Reddy
Hi Hemanth,

Create custom field 'End Date' with data type DATE

Write a workflow field update on this object, entry criteria should be ISCHANGED(DaysNeeded__c) and
update 'End Date' field with 'Today()+DaysNeeded__c' in field update formula

Create a formula field 'Days_Remaining__c' with return type Number

EndDate__c-Today()

You can add condition that when it is greater than 0 then only populate

Make sure that field update should run only when you change 'days needed'



Thank you 
Choose it as best answer if it resolves your issue.
This was selected as the best answer
hemant ranahemant rana
are r sure this can work... its not working