+ Reply to Thread
Results 1 to 8 of 8

Combining IF and Sum functions.

  1. #1
    Registered User
    Join Date
    10-17-2013
    Location
    Newcastle
    MS-Off Ver
    2010
    Posts
    25

    Combining IF and Sum functions.

    I've attached a sheet with the desired outcome that I'm looking for as its hard to describe.

    I think its using Sum and IF function but I can't seem to get the range correct.
    Attached Files Attached Files

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combining IF and Sum functions.

    In cell D13:

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


    Copy down as needed - but be careful, some of your cells contain spaces at the end of the text...
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Combining IF and Sum functions.

    Hi,

    For a start, you have a very inconsistent data set - extra spacing at the end of words ("Compliant " in some cases, "Compliant" in others), different spellings/syntax (Non Compliant/non-compliant) which will need to be cleaned up for a reasonable solution to work.

    Secondly, I'm not sure how you arrive at your desired totals: I can see that there are 17 entries for Compliant in the entire grid, yet only 5 of these correspond to an entry in C4:C8 of Blue - can you please clarify?

    Regards
    Last edited by XOR LX; 11-11-2013 at 09:18 AM.
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Combining IF and Sum functions.

    hi dowell. you could actually do with:
    =COUNTIF($E$4:$M$8,C13)

    but your data is not very clean.
    lots of them have extra spaces. Action required in C15 has no spaces. Action Required in D5 has a space behind
    "Non compliant" without dash in C14, but the 4 of the cells in E4:M8 has dashes

    if your data is really that unclean & you want to match those without dashes too, then maybe:
    =SUMPRODUCT(--(TRIM(SUBSTITUTE($E$4:$M$8,"-"," "))=TRIM(C13)))

    Edit: according to colour would be:
    =SUMPRODUCT((TRIM(SUBSTITUTE($E$4:$M$8,"-"," "))=TRIM(C13))*(TRIM($C$4:$C$8)=LEFT($C$12,FIND(" ",$C$12)-1)))
    Last edited by benishiryo; 11-11-2013 at 09:11 AM. Reason: additional info

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  5. #5
    Registered User
    Join Date
    10-17-2013
    Location
    Newcastle
    MS-Off Ver
    2010
    Posts
    25

    Re: Combining IF and Sum functions.

    I've just realised I put the wrong figures on that upload. Sorry. I need the total of the outcome just for specific systems. I've uploaded the correct sheet now
    Attached Files Attached Files

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Combining IF and Sum functions.

    i second what XOR LX says confused
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  7. #7
    Forum Contributor amit.wilson's Avatar
    Join Date
    07-09-2013
    Location
    Gotham
    MS-Off Ver
    Excel for Mac 2011
    Posts
    283

    Re: Combining IF and Sum functions.

    Hi,

    try this if you want the results just for 'Blue',

    D13: =SUMPRODUCT(($C$4:$C$8="Blue")*($E$4:$M$8=C13))

    ...and copy the formula down into D14, D15 and D16.

    Will work only if the text in C13 to C16 exactly matches the text in E4:M8.

    Cheer
    <-- If you're happy & you know it...click the star.:-)

  8. #8
    Registered User
    Join Date
    10-17-2013
    Location
    Newcastle
    MS-Off Ver
    2010
    Posts
    25

    Re: Combining IF and Sum functions.

    Also Sorry I know that the date is messy. I just had to make up a quick representation of the tables I'm using. My actual spread sheet can't really be uploaded on to this forum.

    I will go through and clean it up before the final formula is put in.

+ 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. Combining 3 IF functions
    By Attrition in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-24-2013, 12:46 AM
  2. Combining 3 IF functions
    By Attrition in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-24-2013, 12:33 AM
  3. Combining multiple functions>lookup/sum functions
    By mush106 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-22-2013, 07:47 AM
  4. Combining IF functions
    By Yappa in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-19-2008, 01:53 PM
  5. Combining IF functions
    By Andrew! in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-18-2008, 04:58 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