Do I need to use a Query

A

aschmitz

I have a data base of thirty rows. I need to be able to access any one
of these rows depending on the input number. eg If the input is 1, I
need to access row 17...if the input is 2, I need to access row 18 and
so on.
How can I accomplish this without using thirty IF-Then statements.

I was told that I needed to use a Query but do not know how.

Any help would be appreciated

aschmitz
 
C

CaptainQuattro

There are several functions you can use in this situation. One I like
to use is the Offset statement.

=offset(HomeCell,Row Offset,Column Offset)


In your example, assuming the database is contained in cells A17 to
Z47, you would set cell $A$16 as your home cell. =Offset($A$16,0,0)
would then
return the contents of cell A16

=Offset($A$16,1,0) returns the contents of cell A17
=Offset($A$16,1,1) returns the contents of cell B17
=Offset($A$16,2,1) returns the contents of cell A18

Now If you set cell A1 as your input cell, you can substitute $A$1 for
the number after the first comma. When you enter a number into Cell
$A$1, the formula will look up a value in the desired row of your
database.
 
Top