Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the use of the offset function

Shulou Source: shulou.com Published: 2022-06-02 14:40:52 10月04日 Update

This article mainly introduces what offset function is used for. The introduction in this article is very detailed and has certain reference value. Interested friends must read it!

Offset is a function in Excel. The function of this function is to take the specified reference as the reference system, and obtain a new reference by giving an offset. The reference returned can be a cell or a cell range, and the number of rows or columns can be specified.

Offset is a function in Excel. In Excel, the OFFSET function takes the specified reference as the reference system and obtains a new reference by giving an offset. The returned reference can be a cell or range of cells. And you can specify the number of rows or columns to return. Reference is the reference area of the offset reference system. Reference must be a reference to a cell or range of contiguous cells; otherwise, OFFSET returns the error #VALUE!.

In Excel, the Offset attribute applies to the following two objects

Offset attribute applied to the Range object.

Returns a Range object representing an area outside of a specified area. Read only.

expression.Offset(RowOffset, ColumnOffset)

Expression is required. This expression returns a Range object.

RowOffset Variant type, optional. The number of rows (positive, negative, or 0 (zero)) for the zone offset. A positive value indicates a downward offset, a negative value indicates an upward offset, and the default value is 0.

ColumnOffset Variant type, optional. The number of columns (positive, negative, or 0) for the region offset. A positive value indicates an offset to the right, a negative value indicates an offset to the left, and the default value is 0.

Offset attribute applied to the TickLabels object.

Returns or sets the distance between level labels and the distance between the first level labels and the coordinate axis. Its default distance is 100 percent, representing the default distance between the axis label and the axis. Its value can be an integer percentage from 0 to 1000, representing the font size of the label relative to the coordinate axis. Long type, can read and write.

expression.Offset

Expression is required. This expression returns a TickLabels object.

attributes sample

Examples applied to Range objects.

This example activates the cell on Sheet1 where the active cell is offset three columns to the right and three rows down.

Worksheets("Sheet1").ActivateActiveCell.Offset(rowOffset:=3, columnOffset:=3).Activate

This example assumes that Sheet1 contains a table with header rows. This example selects the table first, but does not select the header row. Before you can run this example, the active cell must be in the table.

Set tbl = ActiveCell.CurrentRegiontbl.Offset(1, 0).Resize(tbl.Rows.Count- 1, tbl.Columns.Count).Select

Example applied to TickLabels object.

If the offset is less than 500, this example sets the distance between labels on the numeric axis in Chart1 to twice the current distance.

WithCharts("Chart1").Axes(xlValue).TickLabelsIf.Offset < 500 then.Offset = .Offset * 2End If The above is "What is the use of offset function" All the contents of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

Tags: Offset cell object region example function between label application coordinate axis attribute negative value frame of reference type table representative content function title Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Microsoft NVidia Huawei Shulou Tech Info