The syntax of Excel FORMULAR1C1 and how to use it

Source: Internet
Author: User
Tags constant

Features of the ①formular1c1 property

Returns or sets the formula for the specified object, represented by the R1C1 format symbol in the macro language. Variant type, readable and writable.

②FORMULAR1C1 's Grammar

An expression. FormulaR1C1

An expression is a variable that represents a Range object.

Syntax description

If the cell contains a constant, this property returns the constant. If the cell is empty, this property returns an empty string. If the cell contains a formula, this property returns the formula as a string, in the same format as when it appears in the formula bar, including the equal sign.

If you set a value or formula for a cell's format to a date type, Microsoft Excel checks that the cell's format matches a date or time array format, and if not, the default short date number format is used.

If the specified range is a one-dimensional or two-dimensional area, you can specify the formula as an array of the same dimensions in Visual Basic. Similarly, you can use formulas in the Visual Basic array.

To set a formula for a multiple-cell range, all cells in the range are populated with this formula.

A simple example of ③FORMULAR1C1

Example one:

Worksheets ("Sheet1"). Range ("B1"). FORMULAR1C1 = "=sqrt (R1C1)"

To set a formula for the B1 cell of a SHEET1 worksheet, set the formula: "=sqrt (C2)

Example two:

Worksheets (1). Cells (3, 4). FORMULAR1C1 = "=average (Rc[-3]:rc[-2])"

The effect is to set the formula for the D3 cell in the worksheet numbered 1, which is set to the formula: =average (A3:B3)

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.