Offset function in Excel - Usage and examples
The OFFSET function in Excel is a function of the reference and search function group, the following article will describe the syntax, usage and examples of the OFFSET function in Excel, please refer to to understand more about the OFFSET function. .
Description
The Offset function returns a reference to a range a number of rows and a range of cells a specified number of rows and columns. This means that the Offset function returns a reference to a range, based on the position of the cell or the range of cells you specify as a landmark, and moves according to the number of rows and columns you specify.
The reference that the Offset function returns can be a single cell or a range of cells where you specify the number of rows and columns to return.
Syntax
= OFFSET (reference; rows; cols; [height]; [width])
Inside:
- reference is the required argument, is the reference area that you want this to be the starting point (as a landmark) and then based on other arguments to move to the reference reference.
- rows is a required argument, is the number of rows you want to move up or down the reference . If rows are positive, the function will move below the reference , if rows are negative then move up to the reference.
- cols is a required argument, is the number of columns you want to move left or right reference after the function has moved in rows. If cols is positive, the function will move to the right number of cells equal to the number of cols , if the number of cols is negative, the function will move to the left of the cell number by the number of cols .
- height is an optional argument, this is the height calculated by the number of rows you want for the reference to return.
- width is an optional argument, this is the width calculated by the number of columns you want for the reference to return.
Note
- If the rows and cols arguments cause the returned reference area to go beyond the sheet border, the function will return the #REF error value.
- If height and width are omitted in the OFFSET function, the default return reference has the same height and width as the reference region.
- If height and width > 1 means that the function must return more than 1 cell, you must use the array formula OFFSET function otherwise it will get #VALUE!
- The height and width arguments must be positive.
- The OFFSET function does not actually move any cells or change the selection, it only returns a reference.
For example
1. Returns the reference of 1 cell starting from D8, moving down 3 rows to the right by 2 columns.
Use the following formula: = OFFSET (D8; 3; 2)
2. Returns the reference of 2 cells C10: C11 starts from cell D8, moves down 2 rows, to the left by 1 column.
If you just write the OFFSET formula formula = OFFSET (D8; 2; -1; 2; 1) , the function will return the #VALUE! Error. Because this example returns the reference of 2 cells, you need to apply the array formula.
Since the reference returned as 2 cells C10: C11 should you choose any two adjacent cells in a column, then enter the function = OFFSET (D8; 2; 1; 2; 1) entering these you press the Ctrl + Shift + Enter to convert to an array formula. You will get the following result:
4. Use the OFFSET function in combination with the SUM function to sum the returned range.
If you return a reference with multiple cells, you need to write the array formula as in the above example, but if combined with the SUM function, you do not need to use array formulas anymore. You enter the function = SUM (OFFSET (D8; 2; -1; 2; 1))
4. Apply a specific example using the SUM function in combination with OFFSET
When the data is always changing, the OFFSET application is very useful instead of changing the SUM formula every time.
Suppose you have data as shown below.
Every day you have new data, so you have to add new rows to the data table.
You don't want to have to change the SUM formula every time you add data. Please apply the OFFSET function to automatically change when adding new data. In the sum cell you use the formula
= SUM (D7: OFFSET (D14; -1; 0))
The SUM function sums from the first cell in the Revenue column that is cell D7 to the returned reference of the OFFSET function. The OFFSET function returns the reference that is the position in the Total revenue row 1 row, which is the D13 position as shown.
Thus, when you add new rows or delete rows in a data table, the OFFSET formula will update the corresponding position directly above the Total sales cell, and the SUM function will calculate the total more flexibly.
Above the article has introduced to you the syntax, usage and examples of Excel OFFSET function. Hopefully, you will have a better understanding of how to use the OFFSET function and how to apply the OFFSET function to specific cases. Good luck!
You should read it
- IRR function in Excel - Usage and examples
- Excel date function - Usage and examples
- Function Address - The function returns the address of a cell in Excel (usage, examples, examples)
- OR function in Excel, how to use the OR function, and examples
- PMT function in Excel - Usage and examples
- DCOUNT function in Excel - Usage and practical examples
- FIND function in Excel - Usage and examples
- Match function in Excel - Usage and illustrative examples
- VLOOKUP function to use and specific examples
- ROUNDUP function in Excel - Usage and examples
- DSUM function in Excel, how to use DSUM function and examples
- RANK function - Rank function in Excel - Usage and examples
Maybe you are interested
Difference between function and formula in Excel
8 little-known Excel functions that can save you a lot of work
How to use the NORMDIST function in Excel - Function that returns the distribution in Excel
Date functions in Excel, DAY, WEEKDAY, MONTH
How to use the SUMIF function in Excel to calculate the sum based on conditions
How to use the Round function in Excel to round numbers and process data