+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    02-14-2010
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    Microsoft Office 2008 For Mac
    Posts
    8

    Question Using a function to select a cell

    I was wondering if it was possible to specify a cell with a function. For example, if you put in a value of 1, it will give you the value of H1. If you input 2, it will give you H2, and so on.

  2. #2
    Forum Moderator teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    2003 & 2010
    Posts
    10,042

    Re: Using a function to select a cell

    Hi,

    welcome to the forum.

    =INDIRECT("H"&A1)

    where A1 is the number you specify
    teylyn
    Microsoft MVP - Excel
    At Excelforum, you can say "Thank you!" by clicking the icon below the post.

    Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.

  3. #3
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    02-15-2008
    Location
    Grappenhall, UK
    MS-Off Ver
    Excel for Windows & Mac - all versions.
    Posts
    5,826

    Re: Using a function to select a cell

    Hi,

    If I understand you correctly you are wanting to enter a constant and after entry have it change to a formula to evaluate the contents of H1. You can't do this.

    You can put 1 in a cell (say E2) and then in another cell enter the formula
    =INDIRECT("H"&E2)
    which will result in the value in H1, H2 etc.

    HTH
    Richard Buttrey

    If this was useful then please rate it appropriately.

    Click the small star icon at the bottom left of my post.

  4. #4
    Forum Guru rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Using a function to select a cell

    Both Teylyn and RB use Indirect, nothing wrong with that !

    =INDEX(H1:H100,E1,1) will do the same, where E1 (again) is your constant

    Another possibility is to use =OFFSET(H1,E1-1,0)
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  5. #5
    Registered User
    Join Date
    02-14-2010
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    Microsoft Office 2008 For Mac
    Posts
    8

    Re: Using a function to select a cell

    Thanks a lot. I'm sorry if I was unclear, but I did want the constant in another cell. Indirect is what I needed. How do I set this to solved now (or can I)?
    Last edited by dfinlay; 02-16-2010 at 02:56 AM.

  6. #6
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Using a function to select a cell

    FWIW, unless the sheet reference is itself variable I would suggest using Ricardo's INDEX rather than INDIRECT given the latter is Volatile and the former is not.
    (OFFSET too is Volatile).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0