+ Reply to Thread
Results 1 to 2 of 2

Using a variable in a Sumif to reference a different worksheet

  1. #1
    Registered User
    Join Date
    12-18-2017
    Location
    Martinsburg, WV
    MS-Off Ver
    10
    Posts
    14

    Using a variable in a Sumif to reference a different worksheet

    I have a Named Range of values that I need to lookup a value in as my SumIf identifier for the total. However the Table can have additions and deletions and then be resorted so that the direct reference becomes a different value. I am summing three different values to get a composit total. Here is the equation that works, IF I don't change the order of items in the named range.

    =SUMIF(tLUEvnts,Key!A13,tMins) + SUMIF(tLUEvnts,Key!A14,tMins)+SUMIF(tLUEvnts,Key!A25,tMins)

    The issue I face is that the value Key!A13 in the first Sumif and the value Key!A14 and Key!A25 can change position based on additions deletions and resorting in the Named Range. I can actually generate the Location Reference with the following three equations

    ADDRESS(MATCH((VLOOKUP((MID(E66,(FIND("Huddle",E66)),6)),tEvntsTm,1)),tEvnts,0)+3,1) yields the value $A$13
    ADDRESS(MATCH((VLOOKUP((LEFT(E66,7)),tEvntsTm,1)),tEvnts,0)+3,1) yields the value $A$14
    ADDRESS(MATCH((VLOOKUP(MID(E66,FIND(",",E66)+2,3),tEvntsTm,1)),tEvnts,0)+3,1) yields the value $A$25

    The problem is, if I paste those values inline over the A13, the A14 and the A25, I get an error. I have tried using & "" and other means of getting the primary SumIF equation to accept the fixed Named range Value "Key!" and then combine it with the variable value ADDRESS(MATCH((VLOOKUP((MID(E66,(FIND("Huddle",E66)),6)),tEvntsTm,1)),tEvnts,0)+3,1)

    For example:
    =SUMIF(tLUEvnts,Key!ADDRESS(MATCH((VLOOKUP((MID(E66,(FIND("Huddle",E66)),6)),tEvntsTm,1)),tEvnts,0)+3,1),tMins) + etc. etc.
    Is it possible to marry these two values so that Excel reads them as a literal cell reference $A$13 so that my SumIf function will work?

    Thanks so much in advance for any help with this!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: Using a variable in a Sumif to reference a different worksheet

    upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. SUMIF Formula with criteria in variable reference worksheet
    By maym in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-15-2020, 06:30 AM
  2. Sumif function using a variable worksheet name?!
    By blackcat_78uk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-15-2014, 06:51 AM
  3. Macro with variable reference to the worksheet tab
    By tuph in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-16-2014, 10:23 PM
  4. How do I add a variable row number into a SumIf formula cell reference
    By Whit01 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-16-2013, 06:19 AM
  5. Using a cell value to reference a worksheet in SUMIF function
    By tonyamabile in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-04-2011, 02:41 AM
  6. Vlookup with variable worksheet reference
    By trempnvt in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-23-2006, 01:50 PM
  7. how to reference a worksheet with a variable vs a name
    By ibbm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-17-2006, 03:00 PM

Tags for this Thread

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