+ Reply to Thread
Results 1 to 12 of 12

Referincing cell inside of formula

  1. #1
    Registered User
    Join Date
    09-21-2021
    Location
    Bucharest, Romania
    MS-Off Ver
    365
    Posts
    19

    Referincing cell inside of formula

    Hello guys,

    So I'm trying to change a formula based on anther cell and It's driving me crazy. I'll give you an example to make it clear:

    I have 3 Sheets, 1 through 3, in both Sheets 1 and 2 I have information, on Sheet3 I'm trying to make a dynamic way of pulling that information. For example cell A1 in Sheet3 is a dropdown list with the selections Sheet1 and Sheet2 - in cell A2 i want to insert a formula that changes depending on what I select on A1 -

    for example a sum =sum(Sheet1!A:A,B2:B200) but instead of hard writing Sheet1 I want to be able to reference cell A1 for the first part of the range (Sheet1 or 2)

    Would appreciate some suggestions. Thanks!

  2. #2
    Registered User
    Join Date
    04-16-2013
    Location
    Irving, Texas
    MS-Off Ver
    Excel 95 through Excel 2013
    Posts
    22

    Re: Referincing cell inside of formula

    Here's a sample I think is what you're looking for.


    Edit (9/23/21):
    In summary, I created all 3 sheets as you described.
    Data on 2 sheets and formulas on the 3rd.

    On the 3rd sheet, I created cells for you to specify 2 values for criteria and embellished then with data validation.
    Though you did not specify this, it seems important to add this since your formula's proper evaluation would require accuracy in the sheet name selected.

    As for the actual formula, I used a VLOOKUP with the function operative to your request (INDIRECT) nested within.
    Although you used SUM in your OP, I thought that the VLOOKUP would still provide the necessary function (INDIRECT) and show a little more detail about how to concatenate a full reference inside it.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Bilb0_; 09-23-2021 at 09:36 AM.

  3. #3
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Referincing cell inside of formula

    Welcome to the forum - both of you

    Here's a different interpretation:

    In sheet3!A2
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See the attached workbook
    Attached Files Attached Files
    Geoff

    Did I help significantly? If you wish, click on * Add Reputation to say thanks.
    If your problem has been resolved please select ?Solved? from the Thread Tools menu

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: Referincing cell inside of formula

    Quote Originally Posted by Bilb0_ View Post
    Here's a sample I think is what you're looking for.
    Sorry for off-topic interjection:

    Although there is no official rule regarding this behaviour, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.

    I'm sure you understand, and we look forward to seeing you post your formulas/macros in your posts for the searching benefit of all.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Registered User
    Join Date
    09-21-2021
    Location
    Bucharest, Romania
    MS-Off Ver
    365
    Posts
    19

    Re: Referincing cell inside of formula

    Hello, that's it, I've been trying with indirect but must have made a mistake somewhere.

    So the way to reference a cell from another sheet is =INDIRECT($C$4&"!h2") --- where C4 is the cell that states in which sheet the information will be looked in and H2 is the cell from that sheet that needs to be returned. Which is what I needed.

    And a follow up question, is there a way to increment this formula so that (in my example) the next formula would be =INDIRECT($C$4&"!h3") -- h4, h5 etc.? If I lose the $ the C cell gets incremented, but not the H one.

    Thank you guys

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,319

    Re: Referincing cell inside of formula

    Try


    =INDIRECT($C$4&"!"&CELL("address",H3))

  7. #7
    Registered User
    Join Date
    09-21-2021
    Location
    Bucharest, Romania
    MS-Off Ver
    365
    Posts
    19

    Re: Referincing cell inside of formula

    Lifesaver! Huge thanks!

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: Referincing cell inside of formula

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  9. #9
    Registered User
    Join Date
    04-16-2013
    Location
    Irving, Texas
    MS-Off Ver
    Excel 95 through Excel 2013
    Posts
    22

    Re: Referincing cell inside of formula

    I apologize for my oversight.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: Referincing cell inside of formula

    The follow-on question was significantly different and should have been in a new thread. You will find it here: https://www.excelforum.com/excel-for...-criteria.html

    This thread will be marked as solved.

  11. #11
    Registered User
    Join Date
    09-21-2021
    Location
    Bucharest, Romania
    MS-Off Ver
    365
    Posts
    19

    Re: Referincing cell inside of formula

    Did not think it could be anything else than countif. Thanks you!

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: Referincing cell inside of formula

    Precisely - completely different to this thread. It's one thread per issue here - please remember this in future.

+ 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. referincing another workbook using data from within the current workbook
    By Lemon kindling in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-25-2020, 08:18 AM
  2. [SOLVED] formula to extract max range used inside another formula and display in another cell
    By AndyJr in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-04-2018, 11:33 AM
  3. Formula VBA inside corresponding cell, help?
    By avd88 in forum Excel General
    Replies: 2
    Last Post: 01-19-2016, 04:38 PM
  4. Replies: 10
    Last Post: 04-27-2014, 08:16 AM
  5. Replace tab value inside formula with cell value
    By Haywire in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 02-10-2010, 04:04 PM
  6. Change Cell Ref inside a formula
    By dht in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-04-2006, 06:20 PM
  7. Using a value from a cell inside a formula!
    By marsupilami in forum Excel General
    Replies: 5
    Last Post: 08-24-2005, 02:06 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