+ Reply to Thread
Results 1 to 8 of 8

Count if every other 5th cell is equal to 0

  1. #1
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Count if every other 5th cell is equal to 0

    Hi,

    As the title says, I need to count every 5th cell if the cell value = 0.

    I had something something similar on another sheet:

    =SUM(IF(MOD(COLUMN($M4:$FO4),3)=0,$M4:$FO4,0))

    But my poor brain couldn't modify it. Any help appreciated! The cell references don't matter, I can sort those.

    Cheers
    Last edited by Barking_Mad; 11-10-2022 at 08:25 AM.

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

    Re: Count if every other 5th cell is equal to 0

    There are instructions at the top of the page explaining how to attach your sample workbook. Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    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
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,721

    Re: Count if every other 5th cell is equal to 0

    I'm not sure why you have a 3 in the MOD term - shouldn't this be 5 ?

    Also, this will add the contents of the cells if they are zero (i.e. it will result in zero) - if you want to count the cells then you only need 1, like this:

    =SUM(IF(MOD(COLUMN($M4:$FO4),5)=0,1,0))

    Note also that this is an array formula. If you are using XL2019, as your profile says, then you will need to commit the formula using the key combination of CTRL-SHIFT-Enter, instead of the usual Enter.

    Hope this helps.

    Pete

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,721

    Re: Count if every other 5th cell is equal to 0

    Sorry, change that to this:

    =SUM(IF((MOD(COLUMN($M4:$FO4),5)=0)*($M4:$FO4=0),1,0))

    You still need to use Ctrl-Shift-Enter to commit the formula.

    Hope this helps.

    Pete

  5. #5
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Re: Count if every other 5th cell is equal to 0

    Hi Pete,

    Thanks for taking the time to reply. I wanted it to count the number of zeros, but I think your formula sums them. Not sure it then worked when I changed it to COUNT or COUNTIF.

    I've attached a spreadsheet to show how it vaguely looks in my original.
    Attached Files Attached Files

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Count if every other 5th cell is equal to 0

    A3=COUNTIFS(E3:AH3,0,E$1:AH$1,">0")
    Try the above, copy and paste towards down
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  7. #7
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Re: Count if every other 5th cell is equal to 0

    Quote Originally Posted by samba_ravi View Post
    A3=COUNTIFS(E3:AH3,0,E$1:AH$1,">0")
    Try the above, copy and paste towards down
    Hah! Nice bit of lateral thinking. Thanks

  8. #8
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: Count if every other 5th cell is equal to 0

    If its possible there are also zero's between the green cells that shouldn't be count, please try in A3 and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by HansDouwe; 11-10-2022 at 08:59 AM.

+ 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: 3
    Last Post: 04-06-2022, 06:27 PM
  2. [SOLVED] Populate count & sum based on equal to & not equal to factors
    By jscalem in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-20-2015, 01:20 PM
  3. [SOLVED] VBA to count not equal to cell value
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-09-2014, 02:28 PM
  4. Replies: 5
    Last Post: 04-19-2014, 10:09 PM
  5. Replies: 2
    Last Post: 09-23-2013, 01:09 AM
  6. [SOLVED] Formulas count cells that do NOT equal a cell
    By boll55 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-01-2012, 08:53 AM
  7. cell to equal a count of a row and colum
    By MYESKEY in forum Excel General
    Replies: 6
    Last Post: 10-13-2011, 01:59 PM

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