+ Reply to Thread
Results 1 to 11 of 11

How to count values in columns when value is not zero. Stop when 0 and start again when va

  1. #1
    Registered User
    Join Date
    03-20-2024
    Location
    Tilburg, the Netherlands
    MS-Off Ver
    MS365 Version 2312
    Posts
    3

    How to count values in columns when value is not zero. Stop when 0 and start again when va

    Hi All,

    Some background;
    We have produced several articles which took a certain number of hours.
    We have the number of hours per week for all three articles, but we want to know the average run length.
    When there are production hours in following week, we need to sum these values because it is one run. (only 100 hours per week). Thereby we need to stop taking the sum when there is a 0 and start again when there is a value bigger than 0.
    The last part is the most difficult parts which I am not able to count the values with IF statements.

    In the attachment you can find in orange the data. The yellow part is the cells in which I want to put the formulas. The green are both possible solutions. For me it doesn't matter if it is solution 1 or 2 because the average run length is the same.
    Can you please let me know which formulas are suitable for the cells B10:J12?

    Thanks for your help.

    Best regards,
    Stijn
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,845

    Re: How to count values in columns when value is not zero. Stop when 0 and start again whe

    Administrative Note:

    Welcome to the forum.

    Is your forum profile showing the Excel PRODUCT that you need this to work for?

    Members will tailor the solutions they offer to the Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your product is for Mac, please also state this.

    The three most recent Excel products are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the version number in your profile (e.g. MS365 Version 2306). This is in the About Excel section further down the Account page.

    Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-20-2024
    Location
    Tilburg, the Netherlands
    MS-Off Ver
    MS365 Version 2312
    Posts
    3

    Re: How to count values in columns when value is not zero. Stop when 0 and start again whe

    Thanks, I thought it was the version but I have changed it to MS365 right away!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,845

    Re: How to count values in columns when value is not zero. Stop when 0 and start again whe

    It's both - product AND version, please.

    From my post above:

    ... if you are using MS365, please give this name along with the version number in your profile (e.g. MS365 Version 2306)

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,845

    Re: How to count values in columns when value is not zero. Stop when 0 and start again whe

    Your logic does not seem consistent in the second table, but this gets close to what you have suggested as your expected results and may even be more accurate:

    =IF(AND(ISNUMBER(A3),A3>0),0,SUM(IF(B3>0,TAKE(B3:$J3,,MATCH(0,B3:$J3,0)-1))))

    If it's not right, then EXPLAIN your logic.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,004

    Re: How to count values in columns when value is not zero. Stop when 0 and start again whe

    Try this in B10, then copy down and across.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    10-22-2022
    Location
    Santa Cruz, Bolivia
    MS-Off Ver
    MSO 365
    Posts
    145

    Re: How to count values in columns when value is not zero. Stop when 0 and start again whe

    hi everyone, I allow me to propose this alternative solution with one single formula:

    Please Login or Register  to view this content.
    I hope it results useful.

    Question ExcelForum (Alternative Solution).xlsx

  8. #8
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How to count values in columns when value is not zero. Stop when 0 and start again whe

    Hi ExceLogan, a bit off topic, but trying to help and clear a question, are you trying to say "permitame" (Allow me) when you use the expression "I allow me"? (Yo me permito)

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,845

    Re: How to count values in columns when value is not zero. Stop when 0 and start again whe

    There is no ambiguity here that I can see - ExceLogan's meaning is perfectly clear.

  10. #10
    Registered User
    Join Date
    03-20-2024
    Location
    Tilburg, the Netherlands
    MS-Off Ver
    MS365 Version 2312
    Posts
    3

    Re: How to count values in columns when value is not zero. Stop when 0 and start again whe

    Thanks, this was exactly what I needed!

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,845

    Re: How to count values in columns when value is not zero. Stop when 0 and start again whe

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

+ 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: 28
    Last Post: 08-19-2020, 10:17 AM
  2. Replies: 2
    Last Post: 08-06-2020, 04:12 PM
  3. Click Button to start/stop a Stop Watch
    By Aeneren in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-14-2016, 01:25 PM
  4. How to stop automatically converting text columns to date values
    By andy.k in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-07-2013, 10:55 AM
  5. Replies: 3
    Last Post: 09-26-2012, 09:43 AM
  6. Replies: 8
    Last Post: 12-09-2008, 12:38 PM
  7. Identifying Where Values Start and Stop in a Row
    By Gamse in forum Excel General
    Replies: 0
    Last Post: 08-30-2006, 11:24 AM

Tags for this Thread

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