Solved

Understanding offset function

Posted on 2011-02-13
4
288 Views
Last Modified: 2012-05-11
Dear experts,

I have the below formulae,

=IF(COUNT(MATCH(C4,'data elements'!B3:K3,0)*MATCH(E3,'data elements'!A4:A9,0)),INDEX(OFFSET('data elements'!B4:K9,MATCH(B2,'data elements'!A2:A22,0)-1,0),MATCH(E3,'data elements'!A4:A9,0),MATCH(C4,'data elements'!B3:K3,0)),0)

What i want to understand is how does the function 'offset' and ')-1' work, what is the logic of this.

'INDEX(OFFSET('data elements'!B4:K9,MATCH(B2,'data elements'!A2:A22,0)-1,0),'

Thank you
0
Comment
Question by:Excellearner
  • 2
4 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 34882607
The syntax for the Offset function is:

    Offset( range, rows, columns, height, width )

range is the starting range from which the offset will be applied.

rows is the number of rows to apply as the offset to the range. This can be a positive or negative number.

columns is the number of columns to apply as the offset to the range. This can be a positive or negative number.

height is the number of rows that you want the returned range to be.

width is the number of columns that you want the returned range to be.

http://www.techonthenet.com/excel/formulas/offset.php


0
 
LVL 42

Expert Comment

by:sedgwick
ID: 34882613
so to your question -1 is the height relatively the range parameter.
so if range is C4, -1 as height parameter yields C3
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 500 total points
ID: 34882629
In this version of OFFSET

OFFSET('data elements'!B4:K9,MATCH(B2,'data elements'!A2:A22,0)-1,0)

only three arguments are used, range, rows and columns. Height and width are omitted which means that the height and width will remain as per the range.

Column argument is zero so the range will not only remain the same size as range but it will only move vertically. The amount it moves is determined by MATCH function, so if B2 matches the first cell in the MATCH range, i.e. data elements'!A2 then MATCH returns 1 and with -1 that means that the original range is supplied by the OFFSET function.....but if B2 matches with, say, data elements'!A12 then MATCH returns 11 and with -1 that means that the range is just moved down 10 rows and becomes

'data elements'!B14:K19

regards, barry
0
 

Author Closing Comment

by:Excellearner
ID: 34954316
Barry, superb as usual
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now