Consulting

Results 1 to 4 of 4

Thread: Macro to countif multiple criteria

  1. #1
    VBAX Contributor
    Joined
    Mar 2009
    Location
    Porto, Portugal
    Posts
    180
    Location

    Macro to countif multiple criteria

    Hi
    I have this formula to countif multiple criteria in each cell of a certain range on the attached file:
    =SUMPRODUCT(($A$15:$A$20000=M$1)*($E$15:$E$20000=$H2))
    Where red result matches on range (M1:AE1) and blue result matches on range (H2:H14).
    This works almost fine.
    My problem is when I do new entries on entrytable, excel calculates too slow the countif table. And more, It makes the file big (more than 1.5 MB).

    So I thought that a vba solution could solve this issue (I have started to write the code - see the code sheet).

    Any help available for this, please?

    Thanks.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Why don't you just pivot it, it will give you a similar layout and will be much quicker.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Contributor
    Joined
    Mar 2009
    Location
    Porto, Portugal
    Posts
    180
    Location
    Quote Originally Posted by xld
    Why don't you just pivot it, it will give you a similar layout and will be much quicker.
    Honestly, because I don't like and don't feel comfortable with pivot tables. I always try to avoid it.

    But if there isn't another way to speed up the calculation...

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Time to get comfortable, they are so versatile, so flexible so easy, you should utilise them. They are ideal for this task.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •