ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Do I need to use a Query (https://www.excelbanter.com/excel-discussion-misc-queries/79352-do-i-need-use-query.html)

aschmitz

Do I need to use a Query
 

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


--
aschmitz
------------------------------------------------------------------------
aschmitz's Profile: http://www.excelforum.com/member.php...o&userid=32239
View this thread: http://www.excelforum.com/showthread...hreadid=525981


CaptainQuattro

Do I need to use a Query
 

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.


--
CaptainQuattro
------------------------------------------------------------------------
CaptainQuattro's Profile: http://www.excelforum.com/member.php...o&userid=32763
View this thread: http://www.excelforum.com/showthread...hreadid=525981


aschmitz

Do I need to use a Query
 

Captain Quattro,

Thanks for the help. That worked out very nicely!!!



aschmitz


--
aschmitz
------------------------------------------------------------------------
aschmitz's Profile: http://www.excelforum.com/member.php...o&userid=32239
View this thread: http://www.excelforum.com/showthread...hreadid=525981



All times are GMT +1. The time now is 08:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com