Closed Thread
Results 1 to 4 of 4

VB Countif Function on 3 Columns

  1. #1
    Forum Contributor
    Join Date
    09-21-2014
    Location
    USA
    MS-Off Ver
    2013
    Posts
    263

    VB Countif Function on 3 Columns

    Hello All!

    I have been trying to figure this one out, but am having difficulty.

    Issue:
    I have 3 columns with possible dates in one, two or 3 of the rows. if any cell in any one of the columns has a date entered in the same row, then it should count 1 and so on. In the example below, Row1 has 3 dates, count =1. Row2 has 2 dates. Count = 1 + 1 (total of 2). Row 3 has 0. Count = 1 + 1 + 0(total of 2). Row4 has 1 date. Count = 1 + 1 + 0 + 1(total of 3). Row5 has 3 dates. Count = 1 + 1 + 0 + 1 + 1(total of 4). The final count should be 4.

    I coded this as an attempt: =IF(A2<>"",OR(B2<>"",OR(C2<>""))*1,0)
    The above code does not fully work. Combined with I need to convert to VB so that I can loop through an unknown number of rows.

    Hope this makes sense and someone can help.

    Example:
    Column1 Column2 Column3
    11/18/2014 11/18/2014 11/18/2014
    11/18/2014 11/18/2014

    11/18/2014
    11/18/2014 11/18/2014 11/18/2014

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VB Countif Function on 3 Columns

    Here is a formula that works. Remark that this is an ARRAY formula and that you have to end its edition by clicking at CTRL+Shift+Enter at the same time. You'll see that Excel is adding {} at both ends of the formula.
    Please Login or Register  to view this content.
    I'm sure there is other way to do so but this is what I found so far.
    Hope this helps
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Forum Contributor
    Join Date
    09-21-2014
    Location
    USA
    MS-Off Ver
    2013
    Posts
    263

    Re: VB Countif Function on 3 Columns

    Thanks p24leclerc!!! Works perfect. I just need to convert that to a macro which loops.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: VB Countif Function on 3 Columns

    OP has requested that this be closed. OP will post in CS.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How do you ignore hidden COLUMNS in a countif() function
    By Jayson Mora in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-24-2014, 08:05 AM
  2. CountIf Function for two Columns
    By eemiller1997 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-15-2013, 09:23 PM
  3. COUNTIF function across columns, worksheets
    By wernie in forum Excel General
    Replies: 12
    Last Post: 10-20-2012, 10:52 PM
  4. can countif function look at 2 separate columns for criteria
    By blake7 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-16-2006, 04:10 PM
  5. Excel function to countif a criteria is matced within to columns
    By =countif(data!A:A,"001",andif (data!B:B, in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04: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