+ Start a Discussion
Robert WynterRobert Wynter 

formula function to pick a number between 1 and NumberOfLeads , which is the number of leads ina campaign

I have a checkbox and I want to create a formula that if the checkbox is checked. the formula will pick a number between 1 and NumberOfLeads 
Best Answer chosen by Robert Wynter
Ajay K DubediAjay K Dubedi
Hi Robert,

I have understood your requirements. In Campaign, I made a checkbox and a formula field.
1. Checkbox -
   Label - want to count?
2. Formula field
   Label - Count random

formula is - 

IF((Want_Count__c==true) ,IF((NumberOfLeads-1)<=0 ,null,(NumberOfLeads-1))   , null )

It will generate a no in between 1 and NumberOfLeads.
For more help, feel free to ask.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com  (http://www.ajaydubedi.com )

All Answers

Ajay K DubediAjay K Dubedi
Hi Robert,

I have understood your requirements. In Campaign, I made a checkbox and a formula field.
1. Checkbox -
   Label - want to count?
2. Formula field
   Label - Count random

formula is - 

IF((Want_Count__c==true) ,IF((NumberOfLeads-1)<=0 ,null,(NumberOfLeads-1))   , null )

It will generate a no in between 1 and NumberOfLeads.
For more help, feel free to ask.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com  (http://www.ajaydubedi.com )
This was selected as the best answer
Robert WynterRobert Wynter
I had so many people tell me this couldn't be done without creating code including Sf support. Thx so much for the solution.
Robert WynterRobert Wynter
Just realized something. The formula is always picking the second last number. Each time a new person is added and I check and uncheck the trigger it will simple pick the second last. IE. If there are 3 NumberOfLeads then it picks 2 and if there are 11 it picks 10, every time. Any suggestions, please?