• mjfroehlich
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

Please help! I'm new at this. I'm trying to calculate the number of days served in the year. My data fields are date/time but I'm only wanting to calculate the days. I have some that came in the previous year (2011) but I only want to count the days in 2012. I have others that came in 2012 and are still there so I only want to count them through 12/31/2012.There is a total of 4 possibilities.  Here is the formula that I have created but I keep getting Syntax errors. I'm trying to say if the Date Time In and Out fit the criteria then calculate it this way.

 

IF (DAY_ONLY() Date_Time_In__c < 2012-01-01 and Date_Time_Out__c <2012-12-31,  Date_Time_Out__c  -  2012-01-01  + 1,
(DAY_ONLY() Date_Time_In__c > 2012-01-01 and Date_Time_Out__c <2012-12-31, Date_Time_Out__c   - Date_Time_In__c  + 1,
(DAY_ONLY() Date_Time_In__c < 2012-01-01 and Date_Time_Out__c ISBLANK, 2012-12-31  2 - 012-01-01 + 1,
(DAY_ONLY() Date_Time_In__c > 2012-01-01 and Date_Time_Out__c ISBLANK, 2012-12-31  - Date_Time_In__c
))))

 

Is there an easier way to do this?

 

Thanks so much in advance for your help.

Please help! I'm new at this. I'm trying to calculate the number of days served in the year. My data fields are date/time but I'm only wanting to calculate the days. I have some that came in the previous year (2011) but I only want to count the days in 2012. I have others that came in 2012 and are still there so I only want to count them through 12/31/2012.There is a total of 4 possibilities.  Here is the formula that I have created but I keep getting Syntax errors. I'm trying to say if the Date Time In and Out fit the criteria then calculate it this way.

 

IF (DAY_ONLY() Date_Time_In__c < 2012-01-01 and Date_Time_Out__c <2012-12-31,  Date_Time_Out__c  -  2012-01-01  + 1,
(DAY_ONLY() Date_Time_In__c > 2012-01-01 and Date_Time_Out__c <2012-12-31, Date_Time_Out__c   - Date_Time_In__c  + 1,
(DAY_ONLY() Date_Time_In__c < 2012-01-01 and Date_Time_Out__c ISBLANK, 2012-12-31  2 - 012-01-01 + 1,
(DAY_ONLY() Date_Time_In__c > 2012-01-01 and Date_Time_Out__c ISBLANK, 2012-12-31  - Date_Time_In__c
))))

 

Is there an easier way to do this?

 

Thanks so much in advance for your help.