Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
Terry_0101

# How to include an exception?

How best to exclude a certain record type into this formula:     RecordType.Name = "Brazil Deals"

My formula:

IF(
OR(
Campaign_Start_Date__c>DATE(2016,6,30),
Campaign_End_Date__c<DATE(2016,4,1)),0,

IF(
AND(
Campaign_Start_Date__c>=DATE(2016,4,1),
Campaign_End_Date__c<=DATE(2016,6,30)),
(Campaign_End_Date__c-Campaign_Start_Date__c+1)*Avg_Daily_Revenue__c,

IF(
AND(
Campaign_Start_Date__c<=DATE(2016,4,1),
Campaign_End_Date__c>=DATE(2016,6,30)),
(DATE(2016,6,30)-DATE(2016,4,1)+1)*Avg_Daily_Revenue__c,
)))
Shashikant Sharma
Hi Samantha,

You could add one mroe if on the top of your formula

IF( RecordType.Name = "Brazil Deals", 0, rest of Your formula )

This would mean when RecordType.Name = "Brazil Deals" then result will be 0, if you want to put any other value or blank please change accordingly.

```IF( RecordType.Name = "Brazil Deals",
0,
IF(
OR(
Campaign_Start_Date__c>DATE(2016,6,30),
Campaign_End_Date__c<DATE(2016,4,1)),0,

IF(
AND(
Campaign_Start_Date__c>=DATE(2016,4,1),
Campaign_End_Date__c<=DATE(2016,6,30)),
(Campaign_End_Date__c-Campaign_Start_Date__c+1)*Avg_Daily_Revenue__c,

IF(
AND(
Campaign_Start_Date__c<=DATE(2016,4,1),
Campaign_End_Date__c>=DATE(2016,6,30)),
(DATE(2016,6,30)-DATE(2016,4,1)+1)*Avg_Daily_Revenue__c,
)))
)```

Thanks
Shashikant
Mahesh D
Hi Samantha,

```IF(RecordType.Name = "Brazil Deals",IF(
OR(
Campaign_Start_Date__c>DATE(2016,6,30),
Campaign_End_Date__c<DATE(2016,4,1)),0,

IF(
AND(
Campaign_Start_Date__c>=DATE(2016,4,1),
Campaign_End_Date__c<=DATE(2016,6,30)),
(Campaign_End_Date__c-Campaign_Start_Date__c+1)*Avg_Daily_Revenue__c,

IF(
AND(
Campaign_Start_Date__c<=DATE(2016,4,1),
Campaign_End_Date__c>=DATE(2016,6,30)),
(DATE(2016,6,30)-DATE(2016,4,1)+1)*Avg_Daily_Revenue__c,
))), 0)```
Please do let me knwo if it helps you.

Regards,
Mahesh
Parker Edelmann
@Mahesh, the point was to Exclude Brazil Deals, not to include only them. Did you miss an "!" ? @Shashikant Sharma, good job, Thumbs up.
Mahesh D
Hi Samantha,

Sorry type mistake:

```IF(RecordType.Name <> "Brazil Deals",IF(
OR(
Campaign_Start_Date__c>DATE(2016,6,30),
Campaign_End_Date__c<DATE(2016,4,1)),0,

IF(
AND(
Campaign_Start_Date__c>=DATE(2016,4,1),
Campaign_End_Date__c<=DATE(2016,6,30)),
(Campaign_End_Date__c-Campaign_Start_Date__c+1)*Avg_Daily_Revenue__c,

IF(
AND(
Campaign_Start_Date__c<=DATE(2016,4,1),
Campaign_End_Date__c>=DATE(2016,6,30)),
(DATE(2016,6,30)-DATE(2016,4,1)+1)*Avg_Daily_Revenue__c,
))), 0)```

Regards,
Mahesh