• Mahboob Aljiwala
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 11
    Replies
IF(

NOT(ISNULL( Experience1__c )),

TEXT((FLOOR((End_Date__c -Start_Date1__c)/365)) + 
    (FLOOR((End_Date1__c -Start_Date2__c)/365))) & " Years " &

TEXT((FLOOR(MOD((End_Date__c -Start_Date1__c),365)/30)) + 
    (FLOOR(MOD((End_Date1__c -Start_Date2__c),365)/30))) & " Months " & 

TEXT(FLOOR(MOD(FLOOR(MOD((Floor(MOD(Floor(MOD((End_Date__c -Start_Date1__c),365)),30))) + 
                         (Floor(MOD(Floor(MOD((End_Date1__c -Start_Date2__c),365)),30))),365)),30))) & " Days ",


 Experience__c )

To Calculate total experience from 2 experience fields with return type text.
IF(

NOT(ISNULL( Experience1__c )),

TEXT((FLOOR((End_Date__c -Start_Date1__c)/365)) + 
    (FLOOR((End_Date1__c -Start_Date2__c)/365))) & " Years " &

TEXT((FLOOR(MOD((End_Date__c -Start_Date1__c),365)/30)) + 
    (FLOOR(MOD((End_Date1__c -Start_Date2__c),365)/30))) & " Months " & 

TEXT(FLOOR(MOD(FLOOR(MOD((Floor(MOD(Floor(MOD((End_Date__c -Start_Date1__c),365)),30))) + 
                         (Floor(MOD(Floor(MOD((End_Date1__c -Start_Date2__c),365)),30))),365)),30))) & " Days ",


 Experience__c )

To Calculate total experience from 2 experience fields with return type text.
I'm trying to show the Year, Month, Days in word format between two date fields but I can't seem to get it to work right. Below is the formula that I have used. If I have a Lease Start Date as 01.01.2019 and the Lease End Date as 31.12.2019 the formula field shows as 0 Years, 12 Months, 4 Days. Anyone any idea on how I can correct this?

IF(Lease_End_Date__c >= Lease_Start_Date__c, 
TEXT(FLOOR((Lease_End_Date__c - Lease_Start_Date__c)/365)) & " Year(s) " & 
TEXT(FLOOR(MOD((Lease_End_Date__c - Lease_Start_Date__c),365)/30)) & " Month(s) " & 
TEXT(MOD(MOD((Lease_End_Date__c - Lease_Start_Date__c),365),30)) & " Day(s) ", NULL
)

Hi All,
I am trying to get the business days excluding the weekends and including startdate and enddate.
 Below formula I am using to get the business days.
CASE( 
MOD(TODAY()- DATE(1900, 1, 7), 7), 
0, (TODAY()) + BusinessDays__c+ FLOOR((BusinessDays__c-1)/5)*2, 
1, (TODAY()) + BusinessDays__c+ FLOOR((BusinessDays__c)/5)*2, 
2, (TODAY()) + BusinessDays__c+ FLOOR((BusinessDays__c+1)/5)*2, 
3, (TODAY()) + BusinessDays__c+ FLOOR((BusinessDays__c+2)/5)*2, 
4, (TODAY()) + BusinessDays__c+ FLOOR((BusinessDays__c+3)/5)*2, 
5, (TODAY()) + BusinessDays__c+ CEILING((BusinessDays__c)/5)*2, 
6, (TODAY()) - IF(BusinessDays__c > 0,1,0) + BusinessDays__c + CEILING((BusinessDays__c)/5)*2, 
NULL)

I am expecting say for example if  I give input date as 09/28/2018 , Output I should get 10/12/2018 and no. of Business Days as 11.
If I use above formula ,It is counting from the next day instead of from the same Start day.

And also is there a way can I show the Business days label instead of giving number as 11.

I tried to create a formula and also written Apex class .

Any help would be greatly  appreciated.

Thanks,
Sirisha

  

vfpage-----


<apex:page Controller="Employee" showheader="false">
  <apex:form >
   <script type='text/javascript'>
   function runOnEnter(ev) {
        if (window.event && window.event.keyCode == 13 || ev.which == 13) {
            searchEmpRecs();
            return false;
        } else {
            return true;
        }
}
</script>
 <apex:inputText value="{!searchString}" onkeypress="return runOnEnter(event);"/>
  <apex:commandButton value="Submit" action="{!searchEmp}" reRender="pgblcktbl"/>
    <apex:pageBlock title="Employee Details">
     <apex:pageBlockTable value="{!empList}" var="emp" id="pgblcktbl">
        <apex:column value="{!emp.First_Name__c}"/>
           <apex:column value="{!emp.Last_Name__c}"/>
             <apex:column value="{!emp.EmpID__c}"/>
               <apex:column value="{!emp.Email__c  }"/>
                 <apex:column value="{!emp.contact__c}"/>
                <apex:column value="{!emp.cityy__c}"/>
               <apex:column value="{!emp.Address__c}"/>
             <apex:column value="{!emp.Department__c}"/>
        </apex:pageBlockTable>
        </apex:pageBlock>
      <apex:actionFunction name="searchEmpRecs" action="{!searchEmp}" reRender="pgblcktbl"/>
  </apex:form>
</apex:page>

class---------

public class Employee {

    public Employee() {
        empList = new List<Employees__c>();
        empList = [select id,First_Name__c,Last_Name__c,EmpID__c,Email__c,Department__c,contact__c,cityy__c,Address__c from Employees__c];
    }
   
    Public List<Employees__c> empList{get;set;}
    Public string searchString{get;set;}


   Public void searchEmp(){
        searchString += '%';
        empList = new List<Employees__c>();
        empList = [select First_Name__c,Last_Name__c,EmpID__c,Email__c,contact__c,cityy__c,Department__c,Address__c from Employees__c where First_Name__c like : searchString limit 10];
       
    }   
 }