+ Reply to Thread
Results 1 to 9 of 9

Count, CountBlank, Countif on arrays

  1. #1
    Registered User
    Join Date
    08-27-2017
    Location
    Modesto, CA
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    91

    Count, CountBlank, Countif on arrays

    Do Count, CountBlank and CountIf work on arrays and multi-area ranges? Up to what level?

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Count, CountBlank, Countif on arrays

    They are not part of arrays methods or properties, rather they are part of excel functions and can work on range/s.

  3. #3
    Registered User
    Join Date
    08-27-2017
    Location
    Modesto, CA
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    91

    Re: Count, CountBlank, Countif on arrays

    Well, I started to fool around with them, and =Count({1,2,3}) worked. I couldn't get a working syntax for COUNTIF or COUNTBLANK

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Count, CountBlank, Countif on arrays

    Hmm!
    You are still using excel's functions, not arrays in VBA. If you meant be arrays in excel, yes, you can use them as you can use arrays with like in a sum function.

  5. #5
    Registered User
    Join Date
    08-27-2017
    Location
    Modesto, CA
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    91

    Re: Count, CountBlank, Countif on arrays

    I don't understand "with like in a sum function" .

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Count, CountBlank, Countif on arrays

    You have VBA arrays and excel functions arrays(Curly braces where you enter it with CTRL SHIFT plus ENTER. You can use the curly braces with any function in excel.

  7. #7
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Count, CountBlank, Countif on arrays

    Hi all. COUNT, COUNTA, and SUM all work with either ranges or arrays! The various xxIF functions (COUNTIF, SUMIFS, etc.) only accept ranges, but can sometimes be replaced with a SUMPRODUCT construction using arrays.

    EDIT: I'm not sure about COUNTA, it seems unpredictable.
    Last edited by leelnich; 01-19-2018 at 04:13 PM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  8. #8
    Registered User
    Join Date
    08-27-2017
    Location
    Modesto, CA
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    91

    Re: Count, CountBlank, Countif on arrays

    Thanks leelnich. So a VBA SUMIF Function, for example, with the facility to handle arrays might be useful?

  9. #9
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Count, CountBlank, Countif on arrays

    Quote Originally Posted by Alan Beban View Post
    Thanks leelnich. So a VBA SUMIF Function, for example, with the facility to handle arrays might be useful?
    There is no built-in VBA SUMIF Function. You can use most of Excel's Worksheet functions in Excel VBA projects (subject to the same limitations that apply on a worksheet) or you can program a User-Defined Function (UDF), which has it's own limitations, or you can write an event-driven or manually-called VBA procedure.

    May I suggest you start a thread detailing a specific challenge/problem. You'll get more engaged help and perhaps a coding example or two for inspiration. Be sure to post a link to the new thread here so we can follow.
    Last edited by leelnich; 01-19-2018 at 07:51 PM.

+ 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] Countif in arrays with two conditions
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-28-2016, 11:05 AM
  2. [SOLVED] Count inside VBA arrays
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-03-2016, 05:45 AM
  3. [SOLVED] Countif using vba arrays
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-10-2016, 09:20 PM
  4. [SOLVED] Add countIf to textbox (arrays)
    By Lukael in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2014, 01:56 PM
  5. [SOLVED] CountIF VBA Arrays
    By lloydgodin in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-26-2013, 08:09 PM
  6. Countblank - Need code to update countblank numbers as data is updated
    By agregory12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-30-2013, 01:49 AM
  7. [SOLVED] COUNTIF and arrays?
    By aikorei in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-16-2012, 11:27 AM

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