+ Reply to Thread
Results 1 to 12 of 12

Amazing Use of COUNTIFS ...

  1. #1
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Thumbs up Amazing Use of COUNTIFS ...

    Hi Folks..
    This post is about.. speeding up array calculations..
    The Use of countifs which I am gonna explain now is, I think, not known to much people (I suppose..)
    If your Array construction has 4-5 criterias as in the attached example.. then you are now gonna love it..

    Actually we usually use this type of construction in array formulas..
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In the attached file, I think, there are 5-6 such criterias, and It took me 8-12 steps (in Formula Evaluation) with a bit of hanging and excel crash, to get the answer..
    Sounds bad naa...!

    But My friends COUNTIFS and COUNTIF is here so you need not to worry...
    If I use COUNTIFS, the above Equation will be look like this..
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    yes, You got it right.. Criterias and Ranges shuffled their positions..

    Now It will take only 2 step(in Formula Evaluation) to solve the above equation.. No Matter how many criterias are there..

    what you are thinking is absolutely correct.. that is.. the array generated by (Range1=Criteria1)*(Range2=Criteria2)*(Range3=Criteria3) in first formula will always be equal to the array generated by countifs(Criteria1,Range1,Criteria2,Range2,Criteria3,Range3)..

    So you can Imagine how fast excel gonna calculate it now..

    you can also refer to the following link to have a detailed analysis of one of the easier examples..
    http://excel-buzz.blogspot.in/2014/0...xsmall-as.html

    As usual .. suggestion are always invited.. to speed up the calculations (whether array or non array.. (as our expert Mr XOR would like..))

    don't hesitate .. and have a comment..

    Vikas Gautam
    Attached Files Attached Files

  2. #2
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Amazing Use of COUNTIFS ...

    one more clarification...
    The formula is in the sheet2 column K.. in both files..
    So try FORMULA AUDITING and enjoy the difference..

    Both are array formulas...

    Vikas Gautam

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Amazing Use of COUNTIFS ...

    Great stuff, Vikas!

    And yes, I imagine the processing time should be reduced using this construction. Anyone got a timer to test it?

    By the way, I imagine you can't use this set-up with comparisons as well, e.g. ">", etc., correct? Since then the syntax for reversing the criteria_ranges and criteria wouldn't work.

    Cheers
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  4. #4
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Amazing Use of COUNTIFS ...

    yeah XOR...

    Thanks for appreciation..

    Vikas Gautam

  5. #5
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Amazing Use of COUNTIFS ...

    Thanks for Reputation XOR..
    I think we all should endore this technique in our formulas..

    Vikas Gautam

  6. #6
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Amazing Use of COUNTIFS ...

    XOR I think we can use ">" or "<" in our criterias as well...

    As in our array, criterias like... Range1>Criteria1 would become.. countifs(Criteria1,"<" & Range1)

    Thanks for the great idea..

    Vikas Gautam

  7. #7
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Amazing Use of COUNTIFS ...

    Quote Originally Posted by Vikas_Gautam View Post
    XOR I think we can use ">" or "<" in our criterias as well...

    As in our array, criterias like... Range1>Criteria1 would become.. countifs(Criteria1,"<" & Range1)

    Thanks for the great idea..

    Vikas Gautam
    Yes, of course! Then it does indeed have full application as a replacement for multiple array arguments.

    Regards

  8. #8
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Amazing Use of COUNTIFS ...

    I think as I have explained earlier..
    To check the speed difference.. Formula Evaluation Steps can be a base..

    Just count these steps for array(criterias).. and for countif criterias ....
    and the %age difference in these counts.. should, I suppose, the %age difference of there performance...


    Vikas Gautam

  9. #9
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Amazing Use of COUNTIFS ...

    If you wanna add Multiple OR and AND conditions..
    For OR Conditions...
    use countif(Criteria1,Range1)+ Countifs(criteria2,Range2,Criteria3,Range3)
    ---------> Condition1 OR Condition2 AND Condition3

    Vikas Gautam

  10. #10
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Amazing Use of COUNTIFS ...

    Good one Vikas.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  11. #11
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Amazing Use of COUNTIFS ...

    Thanks.. sktneer..
    that means a lot to me..

    Vikas Gautam

  12. #12
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Amazing Use of COUNTIFS ...

    Moreover I don't think that I have ever used this kind of Countifs construction, but I will definitely try it whenever get a chance.

+ 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] The amazing not disappearing box
    By malcmail in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-19-2014, 04:27 PM
  2. Been Here Before... Amazing how helpful
    By thinksnowjob in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 01-14-2013, 10:24 PM
  3. Need quick answer PIVOT/Transpose problem/solution
    By exceldba in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-19-2012, 02:03 PM
  4. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  5. [SOLVED] These templates are amazing! This really shows you care about us!
    By PatHaugen in forum Excel General
    Replies: 0
    Last Post: 06-16-2005, 08:05 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