0

I'm trying to create a row-level formula to calculate the following:

I have a custom object called 'Car Transaction', with the following fields: 'Sign Up Fee' and 'Success Fee'

Here is what I want the formula to do:

If the Sign Up Date and Selling Date falls in this calendar month , then add the Sign Up Fee and Success Fee If the Sign Up Date falls in this calendar month, but Selling Date doesn't fall in this calendar month, then only return the Sign Up Fee If the Selling Date falls in this calendar month, but the Sign up Date doesn't fall in this calendar month, then only return the Success Fee.

I've counted all the commas and I can't find any extra ","

If(
    AND(YEAR(Car_Transaction__c.SIGN_UP_DATE__c) = YEAR(TODAY())),
     MONTH(Car_Transaction__c.SIGN_UP_DATE__c) = MONTH(TODAY()),
     YEAR(Car_Transaction__c.Selling_Date__c) = YEAR(TODAY())),
     MONTH(Car_Transaction__c.Selling_Date__c) = MONTH(TODAY()),
     Car_Transaction__c.Sign_up_Fees__c + Car_Transaction__c.Success_Fee_Due__c,  
 
If(
    AND(YEAR(Car_Transaction__c.SIGN_UP_DATE__c) = YEAR(TODAY())),
     MONTH(Car_Transaction__c.SIGN_UP_DATE__c) = MONTH(TODAY()),
     NOT(YEAR(Car_Transaction__c.Selling_Date__c) = YEAR(TODAY())),
     NOT(MONTH(Car_Transaction__c.Selling_Date__c) = MONTH(TODAY())),       Car_Transaction__c.Sign_up_Fees__c,
 
If(
    AND(YEAR(Car_Transaction__c.Selling_Date__c) = YEAR(TODAY())),
     MONTH(Car_Transaction__c.Selling_Date__c) = MONTH(TODAY()),
     NOT(YEAR(Car_Transaction__c.SIGN_UP_DATE__c) = YEAR(TODAY())),
     NOT(MONTH(Car_Transaction__c.SIGN_UP_DATE__c) = MONTH(TODAY())),       Car_Transaction__c.Success_Fee_Due__c,        
        NULL  )))

1 Answer 1

1

try this :

If(
    AND(YEAR(Car_Transaction__c.SIGN_UP_DATE__c) = YEAR(TODAY())),
     MONTH(Car_Transaction__c.SIGN_UP_DATE__c) = MONTH(TODAY()),
     YEAR(Car_Transaction__c.Selling_Date__c) = YEAR(TODAY()),
     MONTH(Car_Transaction__c.Selling_Date__c) = MONTH(TODAY()),
     Car_Transaction__c.Sign_up_Fees__c + Car_Transaction__c.Success_Fee_Due__c,  
 
If(
    AND(YEAR(Car_Transaction__c.SIGN_UP_DATE__c) = YEAR(TODAY())),
     MONTH(Car_Transaction__c.SIGN_UP_DATE__c) = MONTH(TODAY()),
     NOT(YEAR(Car_Transaction__c.Selling_Date__c) = YEAR(TODAY())),
     NOT(MONTH(Car_Transaction__c.Selling_Date__c) = MONTH(TODAY())),       Car_Transaction__c.Sign_up_Fees__c,
 
If(
    AND(YEAR(Car_Transaction__c.Selling_Date__c) = YEAR(TODAY())),
     MONTH(Car_Transaction__c.Selling_Date__c) = MONTH(TODAY()),
     NOT(YEAR(Car_Transaction__c.SIGN_UP_DATE__c) = YEAR(TODAY())),
     NOT(MONTH(Car_Transaction__c.SIGN_UP_DATE__c) = MONTH(TODAY())),       Car_Transaction__c.Success_Fee_Due__c,        
        NULL  )))   

There was an extra ) in this line YEAR(Car_Transaction__c.Selling_Date__c) = YEAR(TODAY())),

1
  • This fixed it. Thank you!!
    – wycliff
    Dec 10, 2020 at 12:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .