# MFLOOR() Function in Salesforce

This Salesforce tutorial will show you how to utilize the MFLOOR() function to find the nearest round-off integer for numerical data. We’ll additionally focus on the MFLOOR() function’s syntax and a few real-world implementation scenarios.

While employed by a corporation in the United States of America as an event manager. I was given the assignment to determine the campaign reach using campaign management.

So as a solution, I find out that the MFLOOR() function that rounds a number down to the nearest integer. Let’s move and learn the procedure of how to use the MFLOOR() function in Salesforce Lightning and Salesforce Classic.

## MFLOOR function in Salesforce

The MFLOOR() function is one of many mathematical functions available in Salesforce for processing mathematical calculations.

Basically, the closest round-off integer value is calculated using the MFLOOR() function. In addition, if the numerical value is negative in nature it rounds off away from zero.

Furthermore, the Salesforce MFLOOR() function only allows numerical data types like Integers, Decimals, and Currency; if you try to use a text, date, or other non-numeric data type, an error will result.

The syntax of the Salesforce MFLOOR() function is as given below:

``MFLOOR(number/field/formula)``

The parameter number/field/formula is the value for which we are trying to round off the value. The value of the parameter can be a field, a constant number, or a complex formula.

Now, let’s see an example to completely understand the MFLOOR() function:

As I have discussed above that I need to calculate campaign reach. So for this, I will use the MFLOOR() function of Salesforce. Here, is the formula:

``MFLOOR(Campaign_Reach__c)``

With this, we have learned MFLOOR() function, its syntax, and also an example. Now, we will see the difference between the MFLOOR and FLOOR functions of Salesforce.

## Difference between FLOOR and MFLOOR function in Salesforce

The major difference between the Salesforce FLOOR() function and the MFLOOR() function is as follows:

FLOOR() function: The FLOOR function rounds down the number to the nearest integer value. If the number is negative it rounds towards the zero.

MFLOOR() function: The MFLOOR function rounds down the number to the nearest integer value. If the number is negative it rounds away from the zero.

Now, we will move ahead and learn to use this MFLOOR() function in Salesforce Lightning.

## Calculate nearest round off value using MFLOOR function in Salesforce Lightning

Here, are the steps to calculate the nearest round-off value using the MFLOOR function in Salesforce Lightning:

1: Log in to Salesforce Lightning mode, then click the “Gear Icon” in the top right corner of the page. Click “Setup” from the dropdown menu to continue.

2: After clicking on the Setup option, the setup page is open. Click on the “Object Manager” that is present in the Navigation Bar near the Home tab.

3: After clicking on it, the Object Manager page is open. Here we can see lots of objects are present. Search for the object in the search bar where we wish to utilize the MFLLOR() function. In this case, I search for the “Product” object as I want to find out the product price.

4: Now, click on the “Product” object and it will redirect us to the object page of the product.

5: Under this product object page, there is a details section on the left side of the page in which the “Field & Relationship” option is present. Click on the “Field & Relationship” option.

6: After clicking on the field and relationship option, the field and relationships page is open. For using the MFLOOR function select the field type by clicking on the “New” button that is located at the top of the field and relationship page.

7: After clicking on the new button, the data type page is open. There are lots of data types present on the page. Here we are selecting the Formula data type field that is present on the page. The formula field allows users to use the MFLOOR() function.

8: To proceed to the next step, click on the “Next” button.

9: After clicking on the next button, the Choose Output Type page is open. Now enter the details, first fill the “Field Label” and then fill the “Field Name” which automatically fills by simply clicking on the field. In this case, I entered the field label named “Round Up Product Price”.

10: Choose the “Output Data Type” for the field for which we want to calculate the product price.

Here, I select the data type as “Number” to get the formula return type as a number, so I check the radio button in front of it and I also set the “Decimal Place” to 2.

11: Move to the next step by clicking on the “Next” button.

12: Move to the advanced formula editor, and enter the formula that uses the MFLOOR() function. In this case, I want to calculate the price of the product using the respective function. Here, is the formula:

``MFLOOR(Product_Price__c)``

Here, we pass the custom field product price “Product_Price__c” to the MFLOOR function to get the result in the nearest round-off integer.

13: Click on the “Check Syntax” button to validate the formula and ensure that there are no errors.

14: Optionally, we can “Handle the empty field” as well as we can define the “Description” and “Help text” if we want.

15: Click on the “Next” button to move to the formula field-level security step.

16: Now established the “Field-Level Security”. Now select the profiles to which we want to grant edit access to this field via field-level security. The field will be hidden from all profiles if we do not add to it field-level security.

I have selected “Visible” in this case because I want it to be visible to every profile. Then, click on the “Next” button that is present at the top.

17: After establishing the field-level security, now add the custom field to the “Page Layout”Select the page layout that should include this field. This field will be added as the last field of this page layout. The field will not appear on any pages if we do not select a layout.

18: Click on the “Save” button to save the formula field.

We can use the formula field once we’ve created it. Let’s look at an example:

• Open the Products Tab and create a new product with the field Product Price.
• After that, click on the Details section, and here the Round Up Product Price field appears which shows the result of the MFLOOR function.

As a result, we now know how to calculate the nearest round-off value using the MFLOOR function in Salesforce Lightning. Now, we’ll look at how to calculate the nearest round-off value using the MFLOOR function in Salesforce Classic.

## Calculate nearest round off value using MFLOOR function in Salesforce Classic

Here, are the steps to calculate the nearest round-off value using the MFLOOR function in Salesforce Classic:

1: Log in to your Salesforce account first; after you’re logged in, the Salesforce Lightning Edition should already be open. Click “Profile Picture” once you are in Salesforce Classic. The drop-down menu for the profile photo is available. There is a “Switch To Salesforce Classic” option underneath this selection of profile pictures. Just click it.

2: After that, click on the Setup option.

3: The setup page opens after selecting the setup option. Go down to the Build section now. Select the object for whose field we wish to use the MFLOOR() function under Customise after that. In this instance, I use the “Leads” object since I need to keep track of lead conversion to opportunity rate.

4: To get the option for the new field, click on the “Leads” dropdown and choose “Fields”.

5: Next, to add a new formula field, scroll down to “Lead Custom Fields & Relationships” and select the “New” option.

6: It will redirect to the “Choose the field type” page; select the “Formula” data type by selecting the radio button next to it.

7: To proceed to the next step, click on the “Next” button.

8: The unique “Field Name” will be filled out automatically when you enter the “Field Label” for the formula. I entered “Lead Conversion Rate” into the field labeled in this instance.

9: Select the “Data Type” for a field that we want to calculate the nearest round-off value. Make sure the data type must be of a numeric type such as “Number”. So, I check the radio button in front of the “Number” to set it as the formula return type. I also set the decimal place to 0.

10: Now click the “Next” button to go to the next step.

11: Move to the advanced formula editor, and enter the formula that uses the MFLOOR() function to calculate the nearest round-off integer value. In this case, I want to calculate the lead conversion rate using the MFLOOR() function. Here, is the formula:

``MFLOOR(Conversion__c / Total_Leads__c * 100)``
• Here, we divide the conversion rate field “Conversion__ c” by the total leads field “Total_Leads__c”.
• After that, we multiply the resultant value by 100.
• Finally, we pass the whole result to the MFLOOR function to round down the result to the nearest integer value.

12: To check the formula and make sure there are no mistakes, click the “Check Syntax” option.

13: Optionally, we can define the “Description” and “Help text” as well as “Handle the empty field” if we prefer.

14: Click on the “Next” button to move to the next step.

15: Select the relevant “Level Security” field. I have selected “Visible” in this case because I want it to be visible to everyone. Following that, select “Next” to move ahead.

16: Now, select the appropriate “Page Layout” where we want this field to be visible.

17: Lastly, click on the “Save” button to save the formula field.

We can use the formula field once we’ve created it. Let’s look at an example:

• Open the Lead Tab and create a new lead with the fields “Conversion” and “Total Lead”.
• On save, it will redirect us to the Detail Page, and here the “Lead Conversion Rate” field appears which shows us the result of the MFLOOR() function.

As a result, we now know how to calculate the nearest round-off value using the MFLOOR function in Salesforce Classic.

## Conclusion

With this, we have concluded that the Salesforce function MFLOOR() is an excellent tool for handling numerical data. Additionally, we have learned how to calculate the nearest round-up-off integer value.

We also focused on the MFLOOR() Function syntax and several examples from the business world. Moreover, we went over the step-by-step instructions for using the MFLOOR() Function in Salesforce Lightning and Salesforce Classic.