+ Reply to Thread
Results 1 to 4 of 4

SUMIF when Sum and Criteria ranges have different number of rows?

  1. #1
    Registered User
    Join Date
    05-25-2016
    Location
    Hollywood, CA
    MS-Off Ver
    2016
    Posts
    79

    SUMIF when Sum and Criteria ranges have different number of rows?

    I thought I had read that SUMIF ranges didn't have to have the same # of rows, but I can't see how it would work. I have 2 schedules, the "Orig", which I want to remain unchanged (for historical data), and a revised "Sched" that will change. If I add or delete rows (people), on Sched tab, I add/delete the same people from the Table tab, so everything is easy that far. But now Orig and Table have different # of rows - what can I use to still be able to calculate the cost (bottom row)? Also, what if the names are not in the same order as the Table - would this be possible as well?
    I'd be most grateful for any help on this...
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: SUMIF when Sum and Criteria ranges have different number of rows?

    The issues I am seeing is on he orig sheet. However, the "solution" carries over. You already have the spreadsheet set up to handle this; you just have the wrong formula. In the Cost/Week Column, you should have =IFERROR(VLOOKUP(A3,Table2,2,FALSE)*VLOOKUP(A3,Table2,3,FALSE),0)

    Where Table2 is an Excel table containing the information on the Table Sheet. I tend to use tables since they know how big they are and they are easier to reference in formulas. The VLOOKUPS don't care how big the range for the lookup is nor the order in which the names are. I looked up the FTE and the rate and multiplied them together to get the cost. I hope that's the correct calculation.

    I wrapped the formula in an IFERROR statement because you have a couple of people who are on the schedule but not on the list.

    Now you have an even number of rows for the SUMIFS: =SUMIFS(I3:I65,D3:D65,"<>OFF").

    The VLOOLUPS bring the information in from the Table Sheet into the correct number of rows. There is no need to try to go cross-page with the SUMIFS.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    05-25-2016
    Location
    Hollywood, CA
    MS-Off Ver
    2016
    Posts
    79

    Re: SUMIF when Sum and Criteria ranges have different number of rows?

    Actually, I was just trying to calculate Row 69 of Orig in a similar fashion as I did with Row 66 of Sched, but there's 3 less rows in the Table than in the Orig sheet... Could I use Index-Match for this?

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: SUMIF when Sum and Criteria ranges have different number of rows?

    Array formulas - and that's what SUMIF, SUMIFS, COUNTIF, etc. are in disguise even if you don't enter them with CTRL-SHIFT_ENTER - need the same sized ranges. Normally, they are on the same sheet and in different columns, but they don't have to be.

    So you need to come up with two ranges that are the same size. You are working on COST on the Orig sheet, so you will need to work with the same number of rows. You have three more rows on the Orig sheet than you have with the Table sheet. As it turns out, it's three people who are not on the Table sheet.

    So we look up everyone from the Table sheet using VLOOKUP - VLOOKUP doesn't care how many names are on the Table sheet nor what order they might be in. In this case we have a match for every person except the three that aren't on the list. With just plain VLOOKUP, the returned data for these people would be #N/A. So we wrap the VLOOKUP in an IFERROR statement so when someone isn't found, it returns zero.

    We have now created a column of data (Column I) that has as many rows as Column D does. We can use these two columns in a SUMIF or SUMIFS formula.

    Vlookup is just a special case of INDEX / MATCH where the what you are looking up on happens to be in the first column of where you are looking.

+ 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. Replies: 11
    Last Post: 06-30-2016, 07:07 PM
  2. Replies: 11
    Last Post: 02-12-2015, 10:44 AM
  3. Replies: 7
    Last Post: 10-08-2012, 01:53 AM
  4. [SOLVED] how do you make a SUMIF function with two ranges and two criteria
    By martinolooney in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-05-2012, 12:18 PM
  5. Dynamic sumif ranges based on Hlookup criteria
    By Dial1 in forum Excel General
    Replies: 2
    Last Post: 10-24-2011, 01:21 AM
  6. Sumif with 2 ranges of criteria
    By Honey Bee in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-05-2007, 12:52 PM
  7. SUMIF with Mutiple Ranges & Criteria
    By PokerZan in forum Excel General
    Replies: 5
    Last Post: 08-04-2005, 05:31 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