Solved

Understanding offset function

Posted on 2011-02-13
4
314 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

830 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