+ Reply to Thread
Results 1 to 9 of 9

Help! Count value, if there is values in more than 6 cells

  1. #1
    Registered User
    Join Date
    08-26-2011
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    45

    Question Help! Count value, if there is values in more than 6 cells

    Ok so I have a formula which calculates overtime. It pulls data from a range of 7 cells. Numbers are inputted into these cells and any number over 8 ($BC$12) is counted as overtime. However what I now want to add is a condition that if there is data in more than six of the below referenced cells, then the value in the 7th cell automatically gets added to the total regardless of its value. So as an example in the formula below if for example I have data in the cells as follows:

    T17 = 4
    X17 = 4
    AB17 = 4
    AF17 = 4
    AJ17 = 4
    AN17 = 4
    AR17 = 4

    The total number of hours is 28 so it would not trigger a secondary formula for overtime counted over 40 hours, and since none of the cells values exceed 8 then that would not trigger this formula to count it as overtime. What i would like help in doing is since there IS values in more than six of the cells the value in AR17 should automatically counted so in this instance 4 would be the correct answer.

    Would nesting the below formula into a counta do the trick and if so how would I go about doing that and setting the condition to include the any number if the there is values greater than 0 in greater than 6 cells?

    Please Login or Register  to view this content.
    Last edited by Lmao; 02-09-2017 at 10:54 AM.

  2. #2
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Help! Count value, if there is values in more than 6 cells

    It is not clear if you are paying overtime as say AR17=10 in the above scenario, would you wish to add 10 to the result? would this lead to double counting adding +and(t17>0,x17>0,AB17>0.Af17>0, Aj17>0,AN17>0)*AR17 to your formula would do what you ask, but it might not be what you want

    Dav

  3. #3
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Re: Help! Count value, if there is values in more than 6 cells

    I believe the below is what you are looking for?

    =IF(COUNT(A17:F17)=6,MIN(4,MAX(0,(G17-$A$12)+((MIN(4,MAX(0,(A17-$A$12)+MIN(4,MAX(0,(B17-$A$12)))+MIN(4,MAX(0,(C17-$A$12)))+MIN(4,MAX(0,(D17-$A$12)))+MIN(4,MAX(0,(E17-$A$12)))+MIN(4,MAX((F17-$A$12))))))))),MIN(4,MAX(0,(A17-$A$12)))+MIN(4,MAX(0,(B17-$A$12)))+MIN(4,MAX(0,(C17-$A$12)))+MIN(4,MAX(0,(D17-$A$12)))+MIN(4,MAX(0,(E17-$A$12)))+MIN(4,MAX((F17-$A$12)))+MIN(4,MAX(0,(G17-$A$12))))

  4. #4
    Registered User
    Join Date
    08-26-2011
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    45

    Re: Help! Count value, if there is values in more than 6 cells

    Quote Originally Posted by DannyJ View Post
    I believe the below is what you are looking for?

    =IF(COUNT(A17:F17)=6,MIN(4,MAX(0,(G17-$A$12)+((MIN(4,MAX(0,(A17-$A$12)+MIN(4,MAX(0,(B17-$A$12)))+MIN(4,MAX(0,(C17-$A$12)))+MIN(4,MAX(0,(D17-$A$12)))+MIN(4,MAX(0,(E17-$A$12)))+MIN(4,MAX((F17-$A$12))))))))),MIN(4,MAX(0,(A17-$A$12)))+MIN(4,MAX(0,(B17-$A$12)))+MIN(4,MAX(0,(C17-$A$12)))+MIN(4,MAX(0,(D17-$A$12)))+MIN(4,MAX(0,(E17-$A$12)))+MIN(4,MAX((F17-$A$12)))+MIN(4,MAX(0,(G17-$A$12))))
    Couldn't get this to work, I tried replacing the cells with the ones I had in my formula above it looks like this now

    Please Login or Register  to view this content.


    It gave me a result of -4 when all 4s were inputted. However when I changed the values of the cells to 8's the result was "0". The correct result should have been 8 since there is data in all seven of the cells. The seventh cell, AR17, should be counted to give me a total of 8.

    T17 = 8
    X17 = 8
    AB17 = 8
    AF17 = 8
    AJ17 = 8
    AN17 = 8
    AR17 = 8



    Quote Originally Posted by davsth View Post
    It is not clear if you are paying overtime as say AR17=10 in the above scenario, would you wish to add 10 to the result? would this lead to double counting adding +and(t17>0,x17>0,AB17>0.Af17>0, Aj17>0,AN17>0)*AR17 to your formula would do what you ask, but it might not be what you want

    Dav
    I got an error when I tried to input this formula. When I inputted the formula it looks like this

    Please Login or Register  to view this content.
    Last edited by Lmao; 02-10-2017 at 05:28 AM.

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

    Re: Help! Count value, if there is values in more than 6 cells

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  6. #6
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Re: Help! Count value, if there is values in more than 6 cells

    Lmao, If any other cells between T17 and AR17 then it is always going to count above 6 and not 6 exactly. Without a spreadsheet as John has mentioned I am not sure exactly how the spreadsheet is working.

  7. #7
    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
    30,824

    Re: Help! Count value, if there is values in more than 6 cells

    You will only get more than 6 if ALL 7 are filled so confused by addition of AR17 logic.

  8. #8
    Registered User
    Join Date
    08-26-2011
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    45

    Re: Help! Count value, if there is values in more than 6 cells

    I don't have the spreadsheet available at this exact moment however I figured out the formula on my own. I just added =(IF((COUNTIF(T17:AR17,">0"))>6,+AR17,"0"))+ to the front of the formula and it works pretty well for what I need it to do.
    Last edited by Lmao; 02-11-2017 at 07:41 AM.

  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
    30,824

    Re: Help! Count value, if there is values in more than 6 cells

    Remove quotes as this treated as text not number

    =(COUNTIF(T17:AR17,">0"))>6,+AR15,0))

    And why are you adding AR15 (not AR17) ? .... which was not specified in your original post

+ 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: 8
    Last Post: 09-29-2015, 12:53 PM
  2. [SOLVED] Count cells between two cells that have different values in a column
    By rafcaf in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-29-2015, 06:03 PM
  3. Replies: 3
    Last Post: 04-24-2013, 05:33 PM
  4. Replies: 1
    Last Post: 04-24-2013, 05:21 PM
  5. Count cells with certain values
    By WIMP in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 07-10-2010, 04:12 PM
  6. Count cells with values >x and <y
    By jimbob in forum Excel General
    Replies: 6
    Last Post: 07-05-2006, 10:40 AM
  7. [SOLVED] Count cells with specific values in the cells next to them?
    By Christopher in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-08-2005, 01:05 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