Skip to main content
Amin Ahcene a posé une question dans #Formulas

I am trying to refactor that formula , can someone please support on the best way ? 

Thanks in advance 

 

IF(Reverse_Charge__c=true,

  Case(

  Country__c,

  "Switzerland", 0.08,0),

  IF(Override_VAT_Rate__c>0,Override_VAT_Rate__c,

  IF(AND(Invoice_Date__c >= DATE(2017,03,01),

  Country__c="Singapore"),0.07,

  IF(AND(Invoice_Date__c >= DATE(2023,01,01),

  Country__c="Singapore"),0.08,

  IF(AND(Invoice_Date__c >= DATE(2024,01,01),

  Country__c="Singapore"),0.09,

  IF(AND(Invoice_Date__c >= DATE(2020,07,01),Invoice_Date__c <= DATE(2020,12,31),Country__c="Germany"), 0.16,

  IF(AND(Invoice_Date__c >= DATE(2018,01,01),

  Country__c="Switzerland"),0.077,

  IF(Invoice_Date__c>=DATE(2014,05,31),

  CASE(

  Country__c,

  "Switzerland", 0.08,

  "Germany", 0.19,

  "Italy",0.22,

  "Turkey", 0.18,

  "Holland", 0.21,

  "Poland", 0.23,

  "Austria", 0.2,

  "UK", 0.2,

  "Finland", 0.24,

  "Australia", 0.10,

  "Luxenbourg", 0.19,

  0.0),

  CASE(

  Country__c,

  "Switzerland", 0.08,

  "Italy",0.22,

  "Turkey", 0.18,

  "Holland", 0.21,

  "UK", 0.2,

  0.19))

  )

  ))))))

5 réponses
  1. 29 nov. 2022, 13:41

    Can you try this:

    IF(AND(Reverse_Charge__c,Country__c="Switzerland"),0.08,

    IF(Override_VAT_Rate__c>0,Override_VAT_Rate__c,

    IF(AND(Invoice_Date__c>=DATE(2017,03,01),Country__c="Singapore"),0.07,

    IF(AND(Invoice_Date__c>=DATE(2023,01,01),Country__c="Singapore"),0.08,

    IF(AND(Invoice_Date__c>=DATE(2024,01,01),Country__c="Singapore"),0.09,

    IF(AND(Invoice_Date__c>=DATE(2020,07,01),Invoice_Date__c<=DATE(2020,12,31),Country__c="Germany"),0.16,

    IF(AND(Invoice_Date__c>=DATE(2018,01,01),Country__c="Switzerland"),0.077,

    IF(Invoice_Date__c>=DATE(2014,05,31),

    CASE(Country__c,"Switzerland",0.08,"Germany",0.19,"Italy",0.22,"Turkey",0.18,"Holland",0.21,"Poland",0.23,

    "Austria",0.2,"UK",0.2,"Finland",0.24,"Australia",0.10,"Luxenbourg",0.19,0.0),

    CASE(Country__c,"Switzerland",0.08,"Italy",0.22,"Turkey",0.18,"Holland",0.21,"UK",0.2,0.19)))))))))

0/9000