+ Reply to Thread
Results 1 to 6 of 6

Change Cell Ref inside a formula

  1. #1
    Registered User
    Join Date
    12-03-2006
    Posts
    4

    Change Cell Ref inside a formula

    I would like to link all the cell references in my worksheet formulas by reference to an external cell.

    I have monthly financials for each of my store locations. Each of the months are listed in separate columns from left to right (ie. Jan in column B, Feb in column D, etc).

    I also have a summary worksheet that list the current monthly financials for each of the stores in columns (ie Store 1 in column B, Store 2 in column D, etc). I do to this with a very simple = link to the current month in the worksheet noted above.

    I would like to automatically change the cell references in the summary worksheet so that I can move quickly from Jan to Feb. I can use Find and Replace (change $B$ to $D$). However I would rather locate the monthly refernce in a key cell. In this key cell I would simply change B to D and all the formula references in the worksheet would change.

    Someone mentioned the use of "&" embedded in the formulas. Unfortunately I can figure this out or find any reference to this in Microsoft help or knowledge base.

    Can anyone help?

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Do you mean enter D in cell A1 and then sum D1 to D1000. Try an indirect formula

    =SUM(INDIRECT(A1&"1:"&A1&1000))

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    12-03-2006
    Posts
    4

    Still struggling

    I have a worksheet named "Monthly".
    A B
    1 Sept Oct
    2 Rev 100 150
    3 COGS -75 -50

    On a worksheet named "Summary" I have designed the following:
    A
    1 Current Month
    2 Rev =Monthly!A2
    3 COGS =Monthly!A3

    I would like to establish a key cell on Summary, say at A5. This cell would have A or B. If I input A on this key cell, then the results for would be 100. If B then 150.

    I tried =INDIRECT(A5&!A$Monthly&2)

    This did not work.

    Hope you can help.
    dht

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by dht
    I have a worksheet named "Monthly".
    A B
    1 Sept Oct
    2 Rev 100 150
    3 COGS -75 -50

    On a worksheet named "Summary" I have designed the following:
    A
    1 Current Month
    2 Rev =Monthly!A2
    3 COGS =Monthly!A3

    I would like to establish a key cell on Summary, say at A5. This cell would have A or B. If I input A on this key cell, then the results for would be 100. If B then 150.

    I tried =INDIRECT(A5&!A$Monthly&2)

    This did not work.

    Hope you can help.
    dht
    Hi,


    =INDIRECT(A5&!A$Monthly&2)

    =INDIRECT(A5&"!A$Monthly"&2)

    should go better

    but why the '2' ?

    same is

    =INDIRECT(A5&"!A$Monthly2")

    ---

    added but even that looks incorrect, what is in A5 and what final formula did you expect?
    ---
    Last edited by Bryan Hessey; 12-03-2006 at 10:02 PM.
    Si fractum non sit, noli id reficere.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699
    You could try

    =INDIRECT("'Monthly'!"&A5&2)

  6. #6
    Registered User
    Join Date
    12-03-2006
    Posts
    4

    Thanks

    This does the trick!

    Thanks

+ Reply to Thread

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