+ Reply to Thread
Results 1 to 10 of 10

Excel countif with an array

  1. #1
    Registered User
    Join Date
    05-16-2024
    Location
    USA
    MS-Off Ver
    365
    Posts
    3

    Exclamation Excel countif with an array

    A 1
    B 2
    C 3
    D 4
    E 5

    Day 1 A C A E D 14
    Day 2 E D C E D 21
    Day 3 C B A B D 12

    I have a table that contains 100 codes (a,b,c,d,etc) and 100 values (1,2,3,4,etc)
    For Day !, I want to count all of the A's, multiply by 1, count all of the B's multiply by 2, all of the C's, multiply by 3, etc and then get a final answer. In this small example, the answers are 14, 21, 12

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,459

    Re: Excel countif with an array

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,690

    Re: Excel countif with an array

    could you upload a sample workbook (per the yellow banner at the top) WITH expected results?
    it seems a bit confusing as you say you have 100 codes which seem to be alphabetic (a,b,c,d,etc) but the alphabet only goes through 26 to z so what is after that, aa, ab or bb or what?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Registered User
    Join Date
    05-16-2024
    Location
    USA
    MS-Off Ver
    365
    Posts
    3

    Re: Excel countif with an array

    See attached file. .thank you
    Attached Files Attached Files

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,690

    Re: Excel countif with an array

    You uploaded a workbook but
    a) you have what appears to be a working formula
    and in the workbook you are saying that
    b) the codes are more complicated than A, B, C, D and a cell can contain more than one code
    if the workbook isn't a realistic example how can we develop a formula that works?

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

    Re: Excel countif with an array

    One way in G8 and copy down.

    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,178

    Re: Excel countif with an array

    Like this?

    =SUMPRODUCT(COUNTIF(B8:F8,"*"&$B$2:$B$6&"*")*$C$2:$C$6)

  8. #8
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2503 and WPS V2024(12.1.0.18543)
    Posts
    3,944

    Re: Excel countif with an array

    Cell G8 formula Drag down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-16-2024
    Location
    USA
    MS-Off Ver
    365
    Posts
    3

    Re: Excel countif with an array

    THANK YOU SO MUCH! This is exactly what I was looking for!

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

    Re: Excel countif with an array

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    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.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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] Need array formulas for Countif that counts row by row and an array Mod formula
    By Slickback724 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 11-09-2021, 12:38 AM
  2. [SOLVED] COUNTIF without an array
    By Pinkkypie in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-07-2018, 09:00 PM
  3. array countif
    By Fabiany in forum Excel General
    Replies: 7
    Last Post: 10-02-2017, 12:00 PM
  4. [SOLVED] COUNTIF for Array
    By theTaoJones in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-19-2017, 10:50 AM
  5. countif VBA Array's
    By samot79 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-26-2016, 08:44 PM
  6. Array Countif
    By H43825 in forum Excel General
    Replies: 1
    Last Post: 05-01-2009, 12:04 PM
  7. [SOLVED] How do I use countif an array for >=45<=50
    By البيانات in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-04-2006, 04:25 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