+ Reply to Thread
Results 1 to 6 of 6

Change formula range according to Worksheetname

  1. #1
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    105

    Change formula range according to Worksheetname

    Hi,

    Is there a possibility to change the input range for the formula if you change the sheetname in a dropdown list.

    If I select 'Sheet1', the sumif formula calculates with the data in sheet 1.
    If I select 'Sheet2', the sumif formula calculates with the data in sheet 2.

    If possible, no macro-code.
    File with example attached.

    thx
    J
    Attached Files Attached Files

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Change formula range according to Worksheetname

    You can do that with INDIRECT.

    Try
    =SUMIF(INDIRECT("'"&$I$4&"'!F7:F16"),E9,INDIRECT("'"&$I$4&"'!G7:G16"))

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Change formula range according to Worksheetname

    jonas:

    Large:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Small:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Intermediate:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Indirect lets you make a cell value part of the formula.
    One note: you didn't have "$" in your second half of the formulas, so when copied down you will see the rows went from G7:G16 to G8:G17 to G9:G18. I didn't change that, but if it was in error then don't forget to fix that
    Last edited by Arkadi; 06-08-2018 at 08:26 AM.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  4. #4
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    105

    Re: Change formula range according to Worksheetname

    Great man!
    Thanks!
    I had found in on the internet as well, but couldn't figure it out

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Change formula range according to Worksheetname

    You're welcome.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Change formula range according to Worksheetname

    jonas-martens, please take a moment to mark the thread as solved if the issue is resolved? Thanks!

+ 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. Compare to workbooks, and copy certain values if they have the same worksheetname
    By Hjahren in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-10-2014, 07:37 AM
  2. [SOLVED] Change Static Range of Formula to Dynamic Range
    By duugg in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-24-2014, 10:15 AM
  3. [SOLVED] Formula range auto change
    By johncena in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-06-2013, 10:07 AM
  4. [SOLVED] Copying worksheetname to powerpoint slide
    By irfanparbatani in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2012, 01:04 AM
  5. ActiveSheet Range Formula Change
    By aftabn10 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2011, 08:42 AM
  6. copy formula down and ever change range
    By Dean in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2006, 12:10 PM
  7. Changing Worksheetname
    By daniel chen in forum Excel General
    Replies: 2
    Last Post: 04-24-2005, 06:06 PM

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