Java implementation Excel Formula Special topic (i)--excel formula Classification and resolution steps

Source: Internet
Author: User

1) Excel Formula classification

A. Numerical value: In extreme cases, the numerical value is also one of the simplest formulas such as a1=1;

B. Simple function: Simple function refers to the function of the parameter can only be numeric, such as formula A3 (Simple function) =sum (A1:A2), a1=1,a2=3;

C. Complex functions: A complex function refers to a function in a parameter, such as A4 (complex function) =avg (A3,A1);

D. Expression: refers to the arithmetic expression, such as a5= (A4+A1)/a3;

Within the scope of my existing knowledge, Excel Formula function is more than four kinds of cases.


2) Excel Formula parsing--recursion

The arithmetic expression in the most complex class D above requires that the value of A5 be required first, and the value of A4 is required, and the value of A3 and A1 must be calculated. This is a layer of recursion. After the A1, A3 and A4 values are finally calculated, the four +-*/operation is required.

Summary: In general, the parse order is numeric--and simple---complex functions--expressions.


As can be seen, in fact, formula parsing is a tree traversal process, where the leaf nodes are values.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Java implementation Excel Formula Special topic (i)--excel formula Classification and resolution steps

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.