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
KazjamKazjam 

Date calculation help needed

Hi I am new to all this formula stuff and would like some help please.  I have been asked to create a date calculation based on:
 
The date requested (date field) + no of days contracted (text field) and from this I need to
get the = End Date (date field).  So if I request a start date of 10/10/2008 and I have a contract which is 50 days, I want it to tell me the end date of my request?
 
When I try it the formula comes up with expected a date and got text?
 
Thank you in advance.
Nathan CrosbyNathan Crosby
Date_Requested__c + VALUE(No_of_Days_Contracted__c)

This will convert the text to a numeric value if the text entered is a legitimate number.

Another option that would make this more sound would be converting the No_of_Days_Contracted__c to a Number data type. If someone enters alpha characters into this field the formula above will fail and you'll get an error calculation. You could also place validation rules on the same field to make sure the values fall within acceptable ranges.
KazjamKazjam

Hi, thanks but I am still having problems, have I choosen the wrong formula choice?

I still can't seem to get this to work, the no of contract is days is text field.   The required start and end dates are date fields?

so my required start date is the 27th October and I have 50 days contracts for that so my end date will be 50 days after the start date.   Sorry if I seem to be being daft here.

 End date 1 (Number) =
Required_start_date__c + VALUE( No_of_Contracted_Days__c ) = End_date__c

Error: Formula result is data type (Boolean), incompatible with expected data type (Number).
Nathan CrosbyNathan Crosby
It sounds like you are trying to use the formula field to try and update another field which is not the intent of the formula field. The formula field itself should be your End_Date__c field.

Make sure the formula field is of Date data type, rename it to be End_Date__c and use just the following formula:

Code:
Required_start_date__c + VALUE( No_of_Contracted_Days__c )

No need to place the 'End_Date__c = ' portion into the formula field.
KazjamKazjam

I was being stupid I apologise to those trying to figure out what I was doing.  I have this working now, thank you Nathan for your help.:smileyhappy:

 

 

Nathan CrosbyNathan Crosby
No problem, happy to help...and no question is ever a stupid question!