+ Reply to Thread
Results 1 to 2 of 2

Referencing a variable cell in a formula

  1. #1
    Registered User
    Join Date
    03-13-2017
    Location
    Berlin, Germany
    MS-Off Ver
    2016
    Posts
    4

    Referencing a variable cell in a formula

    Is there a way I can set up a formula in terms of a variable cell? For example, suppose A1 = 5 and that I want to reference a cell with column B and row = A1 = 5. Is there a straightforward way of doing this? Anything with syntax as straightforward as something like "B[A1]"?

    Can this be similarly done for columns? For example, if A1 = D, then how about something like "[A1]2" to reference "D2"? It would be even better if the cell could be numerical (with A=1, B=2, C=3, etc).

    This may all seem rather unmotivated, but having recently gotten into Excel from more of a programming background, this is something that has repeatedly entered my mind.
    Last edited by erikh92; 12-19-2017 at 10:36 AM.

  2. #2
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Referencing a variable cell in a formula

    Hi erikh92- You want to look into the INDEX and OFFSET functions.

    INDEX(array, row_num, [column_num]) - returns an element in a 1- or 2- dimensional array ( or range)

    OFFSET(reference, rows, cols, [height], [width]) - returns a cell or cells offset by specified # of rows and columns
    Last edited by leelnich; 12-18-2017 at 11:10 PM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Variable cell referencing a worksheet
    By MeBeMel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-06-2015, 09:54 AM
  2. Having trouble with macro formula referencing - offset? variable? help!
    By cljohnston64 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-14-2015, 10:37 AM
  3. [SOLVED] Using Sum with range cell-variable referencing
    By rkorinko in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-05-2014, 02:38 PM
  4. Referencing Cell Value from Variable Location
    By 1michael in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-16-2013, 01:19 PM
  5. referencing a defined worksheet variable in a formula in vba
    By framptonl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2012, 08:13 PM
  6. Replies: 2
    Last Post: 06-03-2012, 03:33 PM
  7. [SOLVED] Variable Cell Referencing
    By 0-0 Wai Wai ^-^ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-16-2006, 04:40 AM

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.6.0 RC 1