+ Reply to Thread
Results 1 to 6 of 6

Sum cells in a row based on two conditions, one of which also has a condition.

  1. #1
    Registered User
    Join Date
    12-06-2014
    Location
    Cabo, Mexico
    MS-Off Ver
    Office Mac 2011
    Posts
    2

    Sum cells in a row based on two conditions, one of which also has a condition.

    Hi!

    I'm having a hard time with this one:

    I have a document, on the leftmost column, is a list of 200 employees.
    The rest of the columns are divided in groups of 4 (Hours, Level of Work (1-5), Rate, Pay), each group separated by date.
    So it looks something like this:
    A B C D E F G H I K L M N O P Q R
    1 | | | | Date 1 | Date 2 | Date 3 | Total Level 1 Work
    2 |Emp. Numer | Emp. Name | Position | Hours | Lvl | Rate | Pay | Hours | Lvl | Rate | Pay | Hours | Lvl | Rate | Pay | Hours | Pay
    3 | 100 | John | Concierge | 2 | 1 | 15 | 30 |

    I need to calculate How many hours and how much was payed per level of work, during a two month period.
    So I need a formula that Sums the hours in a row, when the level of work for a date is 1, or 2, or, or, 4, or 5.

    I was trying this formula:
    =SUMIF(D2:P2,(IF(D2:P2="Area"&D3:P3=1,"hours")),D3:P3)

    Thanks for your help!
    Screenshot (1).png
    Last edited by Hassen1986; 12-06-2014 at 05:08 PM.

  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,936

    Re: Sum cells in a row based on two conditions, one of which also has a condition.

    Hi, welcome to the forum

    Take a look at the sumifS() function instead

    Also, Please upload a sample of your workbook, not a picture of your data. Pictures are pretty much impossible to edit, and no-one wants to re-type your data for you
    Also, not all members can upload picture files (Company firewalls and stuff)

    Your workbook should show a small desensitized example of the data you are working with and a manual mockup of the expected results.
    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

  3. #3
    Registered User
    Join Date
    12-06-2014
    Location
    Cabo, Mexico
    MS-Off Ver
    Office Mac 2011
    Posts
    2

    Re: Sum cells in a row based on two conditions, one of which also has a condition.

    Thank you for the notes!

    I tried using a SUMIF, but couldn't find a way to make it work.
    It's kinda like SUMIF, but one of the conditions has a condition.
    It's kinda hard for me to explain, I'm a little blocked.

    The Total Level 1 Work Hours cell for each employee should sum the hours, only if the cell right next to it (Level) has a number 1 in it.
    I'm currently doing it manually "=SUMIF(LevelCell#1,1,HoursCell#1)+SUMIF(LevelCell#2,1,HoursCell#2)..."
    But it's going to take me a loooooong time Example.xlsx

    I'm attaching a worksheet as suggested.

    Thank you again for your help!
    Last edited by Hassen1986; 12-06-2014 at 06:45 PM. Reason: Corrected Formulas

  4. #4
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Sum cells in a row based on two conditions, one of which also has a condition.

    Sumifs is definitely a solid way of doing this, however the layout of your sheet is adding to the headache you are having. Once you set it up once, it will not be so bad... but I would recommend changing how you are logging this data - (This is manual entry right?)

    IF so... see attached for recommendation on layout and use -

    Example_Efficient.xlsx
    -If you think you are done, Start over - ELeGault

  5. #5
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Sum cells in a row based on two conditions, one of which also has a condition.

    Please update your profile as necessary to properly reflect the exact version(s) of Excel your question relates to. Members tailor answers based on your Excel version.
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  6. #6
    Registered User
    Join Date
    12-06-2014
    Location
    Nottingham
    MS-Off Ver
    2010
    Posts
    9

    Re: Sum cells in a row based on two conditions, one of which also has a condition.

    if you have 03 or lower, there's a way to create your own sumifs workaround by using =sumif(C:C, A1&B1, F:F) where F is the totals, C:C is the concatenated pair of operators helper column if need be ( you can do this all day outwards) and A1 and B1 is where you're getting criteria from

+ 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. [SOLVED] if condition excel formula from 4 cells values result as of conditions of two cells
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-09-2013, 06:25 AM
  2. Replies: 5
    Last Post: 10-15-2012, 06:33 PM
  3. calculation using reference to cells based on conditions
    By shrimic in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-16-2012, 12:32 PM
  4. Macro to manipulate cells based on several possible conditions of related cells
    By johncena in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-04-2010, 12:14 AM
  5. [SOLVED] Averaging Cells Based On Conditions in Neighboring Cells
    By foofoo in forum Excel General
    Replies: 4
    Last Post: 06-20-2006, 10:20 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