OFFSET Function Examples - Excel & Google Sheets (2024)

This Tutorial demonstrates how to use the Excel OFFSET Function in Excel and Google Sheets to create a reference offset from an initial cell.

OFFSET Function Examples - Excel & Google Sheets (1)

OFFSET Function Overview

The OFFSET Function Starts with a defined cell reference and returns a cell reference a specificed number of rows and columns offset from the original referece. References can be one cell or a range of cells. Offset also allows you to resize the reference a given number of rows/columns.

OFFSET Function Examples - Excel & Google Sheets (2)

(Notice how the formula inputs appear)

IFERROR Function Syntax and Inputs:

=OFFSET(reference,rows,cols,height,width)

reference – The initial cell reference from which you want to offset.

rows – The number of rows to offset.

cols – The number of columns to offset.

height – OPTIONAL: Adjust the number of rows in the reference.

width – OPTIONAL: Adjust the number of columns in the reference.

What is the OFFSET function?

The OFFSET function is one of the more powerful spreadsheet functions as it can be quite versatile in what it creates. It gives the user the ability to define a cell or range in a variety of position and sizes.

CAUTION: The OFFSET function is one of the volatile functions. Most of the time when you’re working in your spreadsheet, the computer will only recalculate a formula if the inputs have changed their values. A volatile function, however, recalculates every time you make a change to any cell. Caution should be used to ensure that you don’t cause a large recalculation time due to excessive use of volatile function or having many cells dependent upon the result of a volatile function.

Basic Row Examples

In every use of the OFFSET function, you need to give a starting point, or anchor. Let’s look at this table to help understand this:

OFFSET Function Examples - Excel & Google Sheets (3)

We’ll use “Bob” in cell B3 as our anchor point. If we wanted to grab the value just below (Charlie), we would say that we want to shift the row by 1. Our formula would look like

=OFFSET(B3, 1)

If we wanted to shift up, that would be a negative shift. You can think of this as the row number is decreasing, so we need to subtract. Thus, to get the value above (Adam), we would write

=OFFSET(B2, -1)

Basic Column Examples

Continuing the idea from previous example, we’ll add another column to our table.

OFFSET Function Examples - Excel & Google Sheets (4)

If we wanted to grab the teacher for Bob, we could use the formula

=OFFSET(B2, 0, 1)

In this instance, we said that we want to offset zero rows (aka stay on same row) but we want to offset 1 column. For columns, a positive number means to offset to the right, and negative numbers mean to offset to the left.

OFFSET and MATCH

Suppose you had several columns of data, and you wanted to give the user the ability to choose which column to fetch results from. You could use the INDEX function, or you can use OFFSET. Since MATCH will return the relative position of a value, we’ll need to make sure the anchor point is to the left of our first possible value. Consider the following layout:

OFFSET Function Examples - Excel & Google Sheets (5)

In B2, we’ll write this formula:

=OFFSET(B2, 0, MATCH(A2, $C$1:$F$1, 0))

OFFSET Function Examples - Excel & Google Sheets (6)

The MATCH is going to look “Feb” in the range C1:F1 and find it in the 2nd cell. The OFFSET will then shift 1 column to the right of B2 and grab the desired value of 9. Note that OFFSET has no problem using the same cell that contains the formula as the anchor point.

NOTE: This technique could be used as a replacement to VLOOKUP or HLOOKUP when you want to return a value from the left/above your lookup range. This is because OFFSET can do negative offsets.

OFFSET to get a range

You can use the 4th and 5th arguments in the OFFSET function to return a range rather than just a single cell. Suppose you wanted to sum 3 columns in this table.

=AVERAGE(OFFSET(A1,MATCH(F2,A2:A5,0),1,1,3))

OFFSET Function Examples - Excel & Google Sheets (7)

In F2, we’ve selected the name of a student that we want to fetch their average test scores for. To do this, we’ll use the formula

=AVERAGE(OFFSET(A1,MATCH(F2,A2:A5,0),1,1,3))

The MATCH is going to search through column A for our name and return the relative position, which is 3 in our example. Let’s see how this will get evaluated. First, the OFFSET is going to go down 3 rows from A1, and 1 column to the right from A1. This places us in cell B3.

=AVERAGE(OFFSET(A1, 3, 1, 1, 3))

Next, we’re going to resize the range. The new range will have B3 as top left cell. It will be 1 row high and 3 columns high, giving us the range B4:D4.

=AVERAGE(OFFSET(A1,3, 1, 1, 3))

Note that while you can legitimately put negative values in the offset arguments, you can only use non-negative values in the sizing arguments.

At the end, our AVERAGE function sees:

=AVERAGE(B4:D4)

Thus, we get our solution of 86.67

OFFSET with dynamic SUM

Because OFFSET is used to find a reference, rather than pointing to the cell directly, it’s most helpful when you are dealing with data that has rows added or deleted. Consider the following table with a Total at the bottom

=SUM(B2:B4)

OFFSET Function Examples - Excel & Google Sheets (8)

If we had used a basic SUM formula here of “=SUM(B2:B4)” and then inserted a new row to add a record for Bill, we would have the wrong answer

OFFSET Function Examples - Excel & Google Sheets (9)

Instead, let’s think of how to solve this from the Total’s view point. We really want to grab everything from cell B2 to the cell just above our total. The way we can write this in a formula is to do a row offset of -1. Thus, we use this as the formula for our total in cell B5:

=SUM(B2:OFFSET(B5,-1,0))

This formula does what we just described: start at B2 and go to 1 cell above our total cell. You can see how after adding Bill’s data, our total gets updated correctly.

OFFSET Function Examples - Excel & Google Sheets (10)

OFFSET to get last N items

Let’s say that you are recording monthly sales but want to be able to look at the last 3 months. Rather than having to manually update your formulas to keep adjusting as new data is added, you can use the OFFSET function with COUNT.

We’ve already shown how you can use OFFSET to grab a range of cells. To determine how many cells we need to shift, we’ll use COUNT to find how many numbers are in column B. Let’s look at our sample table.

=SUM(OFFSET($B$1,COUNT(B:B)-$E$1+1,0,$E$1,1))

OFFSET Function Examples - Excel & Google Sheets (11)

If we started at B1 and offset 4 rows (the count of numbers in column B), we’d end up at the bottom of our range, B5. However, since OFFSET can’t resize with a negative value, we need to do some adjustments so that we end up in B3. The general equation for this is going to be to do

COUNT(…) – N + 1

We take the count of entire column, subtract however many we want to return (since we’ll resize to grab them), and then add 1 (since we’re essentially starting our offset at position zero).

Here you can see we’ve setup a range to get the Sum, Average, and Max of last N months. In E1, we’ve entered the value of 3. In E2, our formula is

=SUM(OFFSET($B$1,COUNT(B:B)-$E$1+1,0,$E$1,1))

The highlighted section is our general equation that we just discussed. We don’t need to offset any columns. We’re then going to resize the range to be 3 cells tall (determined by the value in E1) and 1 column wide. Our SUM then takes this range and gives us the result of $1,850. We’ve also shown that you can calculate the average of max of this same range by simply switching the outer function from SUM to whatever the situation requires.

OFFSET dynamic validation lists

Using the technique shown in last example, we can also build Named Ranges that could be used in Data Validation or charts. This can be helpful when you want to setup a spreadsheet but are expecting our lists/data to change size. Let’s say that our store is starting to sell fruit, and we currently have 3 choices.

<Note – insert image>

<From Indika To Steve- Note from article – Note to Steve: Might need some gifs here, or snapshopts of cells w/ dropdown showing>

To make a Data Validation dropdown that we can use elsewhere, we’ll define the named range MyFruit as

=$A$2:OFFSET($A$1, COUNTA($A:$A)-1, 0)

Instead of COUNT, we’re using COUNTA since we are dealing with text values. Because of this though, our COUNTA is going to be one higher since it’s going to count the header cell in A1 and give a value of 4. If we offset by 4 rows though, we’d end up in cell A5 which is blank. To adjust for this then, we subtract the 1.

Now that we’ve got our Named Range setup, we can setup some Data Validation in cell C4 by using a List type, with source:

=MyFruit

Note that the dropdown only shows our three current items. If we then add more items to our list and go back to the dropdown, the list shows all the new items without us having to change any of the formulas.

Cautions with using OFFSET

As mentioned at the beginning of this article, OFFSET is a volatile function. You won’t notice this if you’re using it in just a few cells, but if you start having it involved in hundreds of calculations and you’ll quickly notice your computer spending a noticeable amount of time recalculating every time you make any changes.

Additionally, because OFFSET doesn’t’ directly name the cells it’s looking at, it is harder for other users to come by later and change your formulas if need be.

Instead, it would be advisable to use Tables (introduced in Office 2007) which allow structural references. These helped users be able to give a single reference that automatically adjusted in size as new data was added or deleted.

The other option to use instead of OFFSET is the powerful INDEX function. INDEX lets you build all the dynamic ranges we saw in this article without the issue of being a volatile function.

Additional Notes

Use the OFFSET Function to return a cell value (or a range of cells) by offsetting a given number of rows and columns from a starting reference. When looking only for a single cell, OFFSET formulas achieve the same purpose as the INDEX Formulas, using a slightly different technique. The real power of the OFFSET Function lies in its ability to select a range of cells to be used in another formula.

When using the OFFSET Function, you define an initial starting cell or range of cells. Then you indicate the number of rows and columns to offset from that initial cell. You can also resize the range; add or subtract rows or columns.

Return to the List of all Functions in Excel

OFFSET in Google Sheets

The OFFSET Function works exactly the same in Google Sheets as in Excel:

OFFSET Function Examples - Excel & Google Sheets (12)

OFFSET Function Examples - Excel & Google Sheets (2024)

FAQs

What is an example of an offset function in Excel? ›

OFFSET can be used with any function expecting a reference argument. For example, the formula SUM(OFFSET(C2,1,2,3,1)) calculates the total value of a 3-row by 1-column range that is 1 row below and 2 columns to the right of cell C2.

What is the offset match function in Excel? ›

The MATCH function can be used to find the position of a value in a singe row or column range. This is used to find the position (or row number) of the value you are looking up in the necessary column. The OFFSET function can be used to locate the corresponding cell in any column by offsetting from its column heading.

What is one of the main differences between Google Sheets and Excel responses? ›

The major difference between Excel and Google Sheets is that you can share the link of Google Sheets with anyone and they can edit the file.

Does offset formula slow down Excel? ›

Excel's OFFSET function will slow your workbook's calculation. There is a better alternative: an unusual syntax of INDEX.

How to do functions in Google Sheets? ›

Click the cell where you want to use the function. Type an equals sign ( = ) followed by the function name and any input value — for example, =DOUBLE(A1) — and press Enter. The cell will momentarily display Loading... , then return the result.

What is the proper function in Google Sheets? ›

In Google Sheets, the PROPER function is used to capitalize the first letter of each word in a given text string. It is commonly used to format names, titles, or any text where you want the first letter of each word to be capitalized. Where text is the text string that you want to capitalize.

How do you calculate off in Google Sheets? ›

Calculate the percentage change: In a new cell, type =((New-Original)/Original)*100 (e.g., =((A2-A1)/A1)*100).

What is the error in offset function in Excel? ›

Tips to consider when using the OFFSET function

If the rows and cols argument values move the formula past the edge of the worksheet, OFFSET returns the #REF! error, which means that the reference is invalid.

What is the offset function in Excel for dynamic calculations? ›

The OFFSET function in Excel lets you find a cell or range of cells by moving a certain number of rows and columns from a starting cell. This is very useful for creating dynamic ranges and calculations that can change automatically as your data changes.

What is the difference between Xlookup and offset? ›

The Excel XLookup Function if used right, allows you to look in one row, and to return the result set from a different row, different tab, or even a different workbook. The term for that is “Offset“. Offsetting is so useful that there is an Excel that strictly, does this, it is the Offset Function.

What makes a Google Sheet better than Excel? ›

The main advantages Google Sheets has over Excel are seamless collaborative functionality, the ability to handle extremely large projects and data sets through its integration with BigQuery, and the automation opportunities available through Google Apps Script.

Why do people prefer Excel over Google Sheets? ›

Data analysis & visualization

Data Analysis: Excel provides more powerful tools like Power Query, giving it an edge for complex analysis. Visualization: Excel offers advanced customization for charts, while Google Sheets has more basic options.

How to calculate offset value? ›

To calculate the offset values for the coordinates that you are working with: Determine the lowest negative X, Y, and Z coordinates within the range of coordinates for the locations that you want to represent. If your data is to include negative measures, determine the lowest of these measures.

What is the indirect and offset function in Excel? ›

The INDIRECT and OFFSET are Volatile functions, that cause recalculation of the formula in the cell where it resides every time Excel recalculates. In workbooks with large data sets and lots of formulas, adding a volatile function can make the worksheet feel sluggish.

How to round to nearest 0.5 in Excel? ›

To round a number down to nearest 0.5, use the FLOOR function, for example =FLOOR(A2, 0.5) . To round a number up to nearest 0.5, use the CEILING function, for example =CEILING(A2, 0.5) . To round a number up or down to nearest 0.5, use the MROUND function, e.g. =MROUND(A2, 0.5) .

References

Top Articles
A Great Mistake Has Been Made | Four Revolutions in the Earth Sciences: From Heresy to Truth | Columbia Scholarship Online
The Consular Speeches: The Ethos of Auctoritas and the Persona of a Consul | Trials of Character: The Eloquence of Ciceronian Ethos | North Carolina Scholarship Online
Maricopa County Property Assessor Search
Myra's Floral Princeton Wv
Luxiconic Nails
Ketchum Who's Gotta Catch Em All Crossword Clue
Scriblr Apa
Ups Drop Off Newton Ks
Munsif Epaper Urdu Daily Online Today
Round Yellow Adderall
Configuring Fail2ban with Traefik
Momokun Leaked Controversy - Champion Magazine - Online Magazine
Nextdoor Myvidster
Cassano's Pizza King Menu and Prices
โลโก้โภชนาการที่ดีที่สุด: สัญลักษณ์แห่งความเป็นเลิศ
Peraton Sso
Kamala Harris is making climate action patriotic. It just might work
Justified - Streams, Episodenguide und News zur Serie
Craigslis Nc
Convert liters to quarts
Food King El Paso Ads
Craigslist Manhattan Ks Personals
Waitlistcheck Sign Up
Jetblue Live Flight Tracker
Winzige Tyrannen: So klein begann das Leben der Tyrannosaurier
Oxycontin Plush Real
Moss Adams Client Portal
Only Murders In The Building Wiki
[마감]봄나들이 갈때 나만의 스타일을 골라보아요~!마감된이벤트 - dodry
Abby's Caribbean Cafe
Urgent Care Near Flamingo Crossings Village
Rooftop Snipers Unblocked Games Premium
Used Zero Turn Mowers | Shop Used Zero Turn Mowers for Sale - GSA Equipment
Reely Hooked Fish Dip Amazon
Ts Central Nj
Classic Buttermilk Pancakes
Costco Gasoline and Sam's Club Fuel Center Gas Savings - Consumer Reports
O2 eSIM guide | Download your eSIM | The Drop
80s Z Cavaricci Pants
Dallas College Radiology Packet
Urgent Care Near Flamingo Crossings Village
Lipidene Reviews 2021
Saratoga Otb Results
Pulp Fiction 123Movies
Scott Deshields Wife
Skagit.craigslist
Tinfoil Unable To Start Software 2022
When His Eyes Opened Chapter 191
Www.888Tt.xyz
Diora Thothub
Edible Arrangements Track
49 CFR Part 581 -- Bumper Standard
Latest Posts
Article information

Author: Jonah Leffler

Last Updated:

Views: 5809

Rating: 4.4 / 5 (45 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Jonah Leffler

Birthday: 1997-10-27

Address: 8987 Kieth Ports, Luettgenland, CT 54657-9808

Phone: +2611128251586

Job: Mining Supervisor

Hobby: Worldbuilding, Electronics, Amateur radio, Skiing, Cycling, Jogging, Taxidermy

Introduction: My name is Jonah Leffler, I am a determined, faithful, outstanding, inexpensive, cheerful, determined, smiling person who loves writing and wants to share my knowledge and understanding with you.