+ Reply to Thread
Results 1 to 22 of 22

How to shorten Too Long Countif formula

  1. #1
    Registered User
    Join Date
    12-27-2018
    Location
    Indonesia
    MS-Off Ver
    2016
    Posts
    10

    How to shorten Too Long Countif formula

    Hi all, this is my first time posting and glad i finally found this forum. I'm using Ms. Excel 2016

    I have a question on how to reduce too long countif formula, let's say i have 84 criteria that i want to look on one data list in excel. when i typed the formula excel returns with you can't use more than 8192 characters in an Microsoft Excel Formula. I attached the the formula that i want to use. Glad if anyone could help.

    Please Login or Register  to view this content.
    Basically i just want to know the value of one criteria after being subtracted with 84 criteria. your replies would be awesome. Thanks
    Attached Files Attached Files
    Last edited by putraguevara; 12-28-2018 at 12:56 AM. Reason: wrong typing

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,474

    Re: How to shorten Too Long Countif formula

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please don't attach a picture of an Excel sheet (no-one will want to re-type all your stuff before starting).

    1. It does NOT have to be your real sheet - mock up a SAMPLE if you need to. But not 1000's of rows!!! It makes manual checking so tedious. Whatever you do... make sure that all confidential information is removed first!!

    2. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    3. Make sure that your desired solution is also shown (mock up the results manually).

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,969

    Re: How to shorten Too Long Countif formula

    Welcome to the forum

    Looks to me like each countifs is essentially the same, the only difference being "1 (W)"
    Have you considered something like
    "* (W)"
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    12-27-2018
    Location
    Indonesia
    MS-Off Ver
    2016
    Posts
    10

    Re: How to shorten Too Long Countif formula

    is it possible to add *, if i only have certain amount of 1 (W), let's say 1 (W) until 12 (W). gonna try it first. Thanks for the reply though

  5. #5
    Registered User
    Join Date
    12-27-2018
    Location
    Indonesia
    MS-Off Ver
    2016
    Posts
    10

    Re: How to shorten Too Long Countif formula

    it doesn't work, though. wish i could attached the excel

  6. #6
    Registered User
    Join Date
    12-27-2018
    Location
    Indonesia
    MS-Off Ver
    2016
    Posts
    10

    Re: How to shorten Too Long Countif formula

    hi glenn, thanks for the reply, but i still couldn't attached my excel file. it says have to wait after posting few thread

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,474

    Re: How to shorten Too Long Countif formula

    Not so. Try again. You cannot post www links, but you can post files.

  8. #8
    Registered User
    Join Date
    12-27-2018
    Location
    Indonesia
    MS-Off Ver
    2016
    Posts
    10

    Re: How to shorten Too Long Countif formula

    Hi, Glenn thanks so much for the guidance. here is the excel

    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,474

    Re: How to shorten Too Long Countif formula

    More explanation please... To count Special category in Widhya Asih is easy:

    =COUNTIFS(B:B,"Widhya Asih",C:C,"Special")

    but you need to explain the connection between columns I to P and school grade....

  10. #10
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How to shorten Too Long Countif formula

    Does this give the expected result?

    =COUNTIFS(B4:B3615,"Widhya Asih",F4:F3615,"<>*(*)")

    edit:- Missed the bit about "Special", maybe this one instead?

    =COUNTIFS(B4:B3615,"Widhya Asih",C4:C3615,"Special",F4:F3615,"<>*(*)")

  11. #11
    Registered User
    Join Date
    12-27-2018
    Location
    Indonesia
    MS-Off Ver
    2016
    Posts
    10

    Re: How to shorten Too Long Countif formula

    As you can see, on the excel file there are two data. The first one is the data list and the second one is the category that i want to look for.

    In this problem, i want to find out how many students that are in widhya asih, with special category that its school grade doesnt belong to the "category that i want to look for" list.

    Lets say it will count how many students from widhya asih that belong in special category with the school grade of 7 or any other number as long as it doesn't listed on the "category that i want to look for"

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,474

    Re: How to shorten Too Long Countif formula

    So this counts Place, Category and (maybe??) Grade

    In Q5, copied down:
    =COUNTIFS(B:B,"Widhya Asih",C:C,"Special",F:F,I5)

    If this is NOT correct, please supply manually calculated results.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    12-27-2018
    Location
    Indonesia
    MS-Off Ver
    2016
    Posts
    10
    Quote Originally Posted by Glenn Kennedy View Post
    So this counts Place, Category and (maybe??) Grade

    In Q5, copied down:
    =COUNTIFS(B:B,"Widhya Asih",C:C,"Special",F:F,I5)

    If this is NOT correct, please supply manually calculated results.
    Please Login or Register  to view this content.
    I enclose the sum amount i want to look for. The countifs should display the sum of filtered result.

    But somehow it didn't
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How to shorten Too Long Countif formula

    Why is row 1471 not counted? It is not in the table to exclude?

    To exclude

    =COUNTIFS(B4:B3615,"Widhya Asih",C4:C3615,"Special",F4:F3615,"<>*",F4:F3615,"<>")

    to include

    =COUNTIFS(B4:B3615,"Widhya Asih",C4:C3615,"Special",F4:F3615,"<>*(*)",F4:F3615,"<>")

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,474

    Re: How to shorten Too Long Countif formula

    OK! My previous formula gave that result, but split by Grade (so... 0 class 1, 4 calss 11, 6 class 12. For an overall total, use this array formula:

    =COUNT(IF($B$5:$B$4000="Widhya Asih",IF($C$5:$C$4000="Special",IF(ISERROR(MATCH($F$5:$F$4000,$I$5:$I$16,0)),"",$F$5:$F$4000))))

    It's in R6.



    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    12-27-2018
    Location
    Indonesia
    MS-Off Ver
    2016
    Posts
    10

    Re: How to shorten Too Long Countif formula

    hi, i just opened the reply, it seems work for me. Would you explain me how the formula works? just wondering about the flow. Thanks for your help though

  17. #17
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How to shorten Too Long Countif formula

    So to simplify it, you want to count how many Rows contian "Widhya Asih", "Special" and a number in column F (no text or blanks).

    Which is exactly what my much simpler suggestion (which you chose to ignore) does.

    If you want an answer, just accept any one given to you, if you want a solution, then look at all of the answers given to you!

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,474

    Re: How to shorten Too Long Countif formula

    Great!!

    =COUNT(IF($B$5:$B$4000="Widhya Asih",IF($C$5:$C$4000="Special",IF(ISERROR(MATCH($F$5:$F$4000,$I$5:$I$16,0)),"",$F$5:$F$4000))))

    Red: Ff this is true, return TRUE/FALSE
    Orange: AND this is true
    Green: If the value in column F is NOT found in I5 to I16, return a blank, otherwise
    Blue: return the value in column F..

    Black: If the conditions are both true AND a number in F has been returned, count the cells that meet those conditions.

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  19. #19
    Registered User
    Join Date
    12-27-2018
    Location
    Indonesia
    MS-Off Ver
    2016
    Posts
    10

    Re: How to shorten Too Long Countif formula

    hi, dude. happy new year 2019, wish you be blessed year ahead.

    Nope, i am not ignoring your suggestion, it's been a big help for me. i had alternatives in clearing my work. Thanks lot for the trick. I am just a noob, sorry if my words were offend you.

  20. #20
    Registered User
    Join Date
    12-27-2018
    Location
    Indonesia
    MS-Off Ver
    2016
    Posts
    10

    Re: How to shorten Too Long Countif formula

    Quote Originally Posted by jason.b75 View Post
    Why is row 1471 not counted? It is not in the table to exclude?

    To exclude

    =COUNTIFS(B4:B3615,"Widhya Asih",C4:C3615,"Special",F4:F3615,"<>*",F4:F3615,"<>")

    to include

    =COUNTIFS(B4:B3615,"Widhya Asih",C4:C3615,"Special",F4:F3615,"<>*(*)",F4:F3615,"<>")
    Hi jas, i just figured out that the "<>*(*) characters were awesome, thanks for enlightening me with this, never know it before.

    Thanks lot

  21. #21
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How to shorten Too Long Countif formula

    You're welcome!

    Sorry if my previous response was a bit harsh, it can be quite common for new members to take a discourteous approach to the help that they are given on the forum, which was how was looking at you acknowledging Glenn's replies but not mine.

    Even the most experienced people on this forum learn new things from the answers provided here. Even answers that are 'wrong' for the question asked at the time can contain useful things that you might not have known previously.

  22. #22
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,427

    Re: How to shorten Too Long Countif formula

    Quote Originally Posted by jason.b75 View Post
    ...
    Even the most experienced people on this forum learn new things from the answers provided here. Even answers that are 'wrong' for the question asked at the time can contain useful things that you might not have known previously.
    Amen to that!
    Dave

+ 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. Shorten a Countif/Sumproduct formula
    By her.rockstar in forum Excel General
    Replies: 5
    Last Post: 10-02-2018, 02:24 PM
  2. [SOLVED] formula too long, not sure how to shorten
    By Jane in forum Excel Formulas & Functions
    Replies: 22
    Last Post: 01-18-2016, 11:54 PM
  3. Shorten very long vlookup formula
    By pframpton in forum Excel General
    Replies: 2
    Last Post: 08-27-2015, 09:42 AM
  4. Long formula, need to shorten
    By BlairStevenson in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-06-2014, 12:23 PM
  5. [SOLVED] Too Long formula to shorten help
    By lapot in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-14-2014, 07:51 AM
  6. [SOLVED] Shorten a very long Formula
    By Floydlevedale in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-15-2013, 09:39 AM
  7. How to shorten the formula - IF(SUM(COUNTIF(
    By fang603 in forum Excel General
    Replies: 2
    Last Post: 03-09-2012, 08:59 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