+ Reply to Thread
Results 1 to 17 of 17

Simplify this formula for summing a row with multiple criterias

  1. #1
    Registered User
    Join Date
    09-04-2013
    Location
    australia
    MS-Off Ver
    Office 2013
    Posts
    12

    Simplify this formula for summing a row with multiple criterias

    I have a need to find an average percentage for a given row of numbers when each cell is divided by three. The kicker is that I have to use multiple criteria per cell to then work out what the percentage should be. A bit hard to explain but I have a formula that works fine however I know that there is an easier way to write this using a SUM formula and ranges and possibly INDEX and MATCH but i just can't get my head around it...

    So this is the formula that I have at the moment:

    Please Login or Register  to view this content.
    Basically this formula looks through the range of C6:AG6 (albeit one at a time which is what I know I can do in one hit with a range) and if the cell contains a 0,1,2 or 3 it then divides that cell by 3. If the cell is greater than 3 AND it doesn't contain an "x" then it makes that value a 1 (anything more than 3 is classed as 100%). If the value of the cell is "x" then it is given a 0. Once it does this for each of the cells in that row it then adds them all together (I know this can be done by a SUM formula and a range) and then divides it by the value in cell AI6 to obtain and average percentage. Outside of all of this if there is an error it just displays a blank cell just to keep things looking nice.

    Hopefully that makes sense. Basically I know that the above formula is very long winded and I am sure that there is a quick easy way to do this via an array formula or something but just can't get it to work. If someone could help out it would be great. The above formula works fine but just not knowing how to make it cleaner is just doing my head in....

    Sorry if it is hard to read the formula.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,300

    Re: Simplify this formula for summing a row with multiple criterias

    Please post a sample file showing expected results.

  3. #3
    Registered User
    Join Date
    09-04-2013
    Location
    australia
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Simplify this formula for summing a row with multiple criterias

    I need the values to look like this

    x = a day off so not counted in the average percentage
    minimum target is three per day - so 3 = 100% for that day
    anything over 3 is just counted at 100% for that day
    percentages averaged over the 7 days worked to get the percentage at the end.

    As above my long winded formula does the trick but after something smaller.

    3 3 0 x 1 4 2 3 Days worked: 7 Percentage: 71.4%
    Last edited by phatal; 09-17-2015 at 01:55 AM.

  4. #4
    Registered User
    Join Date
    09-04-2013
    Location
    australia
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Simplify this formula for summing a row with multiple criterias

    Quote Originally Posted by JohnTopley View Post
    Please post a sample file showing expected results.
    Sorry didn't see this before I posted the table. Will the table be OK? That is pretty basic but it is all I am after.

  5. #5
    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,945

    Re: Simplify this formula for summing a row with multiple criterias

    I am looking for another method here, but this will already shorten it considerably.
    Change these parts...
    IF(AND(C6>-1,C6<4),(C6/3),(IF(AND(C6>3,C6<>"x"),1,0)))
    to this...
    IFERROR(MIN(1,C6/3),0)
    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

  6. #6
    Registered User
    Join Date
    09-04-2013
    Location
    australia
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Simplify this formula for summing a row with multiple criterias

    Thanks that seems to actually work OK. Now just have to put it into a formula (if possible) to make that C6 reference be every cell in a range / row and then sum them together.

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

    Re: Simplify this formula for summing a row with multiple criterias

    Hi.

    I think an actual workbook with an example together with expected result(s) would be of benefit.

    Regards
    Click * below if this answer helped

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

  8. #8
    Registered User
    Join Date
    09-04-2013
    Location
    australia
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Simplify this formula for summing a row with multiple criterias

    Quote Originally Posted by XOR LX View Post
    Hi.

    I think an actual workbook with an example together with expected result(s) would be of benefit.

    Regards
    How do I make that happen???? Dropbox link or something?

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,300

    Re: Simplify this formula for summing a row with multiple criterias

    Hi again.
    Click "Go Advanced" then paper clip icon to upload file.

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

    Re: Simplify this formula for summing a row with multiple criterias

    No. Click on Go Advanced and then scroll down to Manage Attachments.

    Regards

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,300

    Re: Simplify this formula for summing a row with multiple criterias

    There appears be inconsistencies in the logic: 0,1,2,3 - divide by 3 but3/3=1 so should we not do the following

    SUM values >=1 and <=2 and divide result by 3 =SUMIF(A1:H1,"<=2")/3

    COUNT number of entries >=3 =COUNTIF(A1:I1,">=3")

    Add the above together =SUMIF(A1:H1,"<=2")/3 + COUNTIF(A1:I1,">=3")

    With your data ... 1+4 =5

  12. #12
    Registered User
    Join Date
    09-04-2013
    Location
    australia
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Simplify this formula for summing a row with multiple criterias

    Test.xlsx

    Did that work?

    Just made up a quick spreadsheet to show you what I mean....

  13. #13
    Registered User
    Join Date
    09-04-2013
    Location
    australia
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Simplify this formula for summing a row with multiple criterias

    Quote Originally Posted by JohnTopley View Post
    There appears be inconsistencies in the logic: 0,1,2,3 - divide by 3 but3/3=1 so should we not do the following

    SUM values >=1 and <=2 and divide result by 3 =SUMIF(A1:H1,"<=2")/3

    COUNT number of entries >=3 =COUNTIF(A1:I1,">=3")

    Add the above together =SUMIF(A1:H1,"<=2")/3 + COUNTIF(A1:I1,">=3")

    With your data ... 1+4 =5
    WOW I think that works!!!

    See attached:

    Test2.xlsx

  14. #14
    Registered User
    Join Date
    09-04-2013
    Location
    australia
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Simplify this formula for summing a row with multiple criterias

    Yep looks like it works great. Pretty amazing really.... I was thinking waaaaaay to complicated.....

    Thanks so much I can sleep now.

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,300

    Re: Simplify this formula for summing a row with multiple criterias

    Yes: file received. Does my formula give the correct answers?

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,300

    Re: Simplify this formula for summing a row with multiple criterias

    Sorry: posts crossed. If the problem is resolved, could you mark thread as SOLVED (See "Thread Tools" at top of the thread).

    Thank you.

  17. #17
    Registered User
    Join Date
    09-04-2013
    Location
    australia
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Simplify this formula for summing a row with multiple criterias

    Quote Originally Posted by JohnTopley View Post
    Sorry: posts crossed. If the problem is resolved, could you mark thread as SOLVED (See "Thread Tools" at top of the thread).

    Thank you.
    Will do mate. Thankyou so much.

    Just updated it again now with the error handling to show blanks when no data. Works a treat.

    Test3.xlsx

+ 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] Summing a column based on two criterias (tried using sumif)
    By Dbauddls90 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-12-2014, 01:39 PM
  2. summing ranges by criterias
    By adygelber in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2014, 05:58 AM
  3. [SOLVED] Summing value on a column in multiple criterias in multiple sheet
    By radicrains in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-12-2013, 11:51 PM
  4. [SOLVED] Summing value on a column in multiple criterias in multiple sheet
    By radicrains in forum Excel General
    Replies: 2
    Last Post: 02-12-2013, 11:51 PM
  5. Replies: 2
    Last Post: 12-08-2011, 09:07 AM
  6. summing a pivot table based on for criterias
    By jwongsf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-17-2009, 05:17 PM
  7. Summing Entries with Criterias
    By lazyme in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-27-2007, 08:59 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