Solved

Understanding offset function

Posted on 2011-02-13
4
327 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
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.

628 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