How Excel customizes functions

Source: Internet
Author: User

Excel can customize the functions to address personal problems in a targeted way.

By default, Excel 2016 does not display the development tools option, you need to go to the file → options → custom ribbon, and then on the right, select Development tools and click OK to return.

Next switch to the Developer tab, click the Visual Basic button on the left side of the toolbar to open the VBA Development window, click the Insert → module menu in the window, and then customize the function in the Open Module window. Here, enter a simple piece of code in the module window:

Function product (A As Integer, B as Integer)

Product = (A * b)

End Function

"Function" means that this is a function, the "product" is the name of the function, with two arguments declared in parentheses, integers a and b respectively. The middle line of code is the multiplication of the two integers. The last line of "End Function" indicates that the function ended.

Now go back to the Excel table and try the custom function. Enter the formula "= Product (A1,B1)" In the cell of the A1 cell to enter the 20,a3 cell 10,A2 the correct product number.

Of course, this is just a simple example of a function where you can enter more complex code to accomplish more detailed tasks.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.