+ Reply to Thread
Results 1 to 12 of 12

Need a counting formula

  1. #1
    Registered User
    Join Date
    07-11-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    50

    Need a counting formula

    Hello, I need a formula that will count in a very specific way. Here is an example of the data I am working with.

    Example.xlsx

    So essentially there is a serial code with many inlet and outlet temperatures. What I need to count is how many unique serial codes have a temperature that goes above 225 and how many have a temperature that goes below 125. The expected results are included in the example spreadsheet.

    Let me know if there are any questions.

    Thank you!
    Last edited by Ferloft; 07-31-2013 at 11:56 AM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Need a counting formula

    What column are you expecting to find value less than 125 in?

    Or

    Can the value be in either column B or C

  3. #3
    Registered User
    Join Date
    07-11-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Need a counting formula

    The value can be in either B or C

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Need a counting formula

    Hmm?

    I might have jumped the gun here, but see if this gives the results you need.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Registered User
    Join Date
    07-11-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Need a counting formula

    Well it is going to be used with a much longer list of data points so I am more looking for a formula that will give me the result straight from the data. In other words I'd rather not add a new table.

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Need a counting formula

    Post #4 takes the Columns individually.

    This workbook checks both columns for your conditions simultaneously.

    Note The formulae in F2 & I2 are CSE array formulae, and must be confirmed with Ctrl+Shift+Enter before dragging down.

    [EDIT]
    ... I am more looking for a formula that will give me the result straight from the data ...
    That is bit more ambitious, and any formula solution will probably drag your workbook down.

    How many Rows of data are you likely to have?
    Attached Files Attached Files
    Last edited by Marcol; 07-31-2013 at 03:28 PM.

  7. #7
    Registered User
    Join Date
    07-11-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Need a counting formula

    Going to have upwards of 20000 rows of data. If you need to add another column to help with the count that is okay, I just don't want to make a new table.

  8. #8
    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,945

    Re: Need a counting formula

    Looking at your sample and expected results, I used...
    =COUNTIF(B2:C101,">225") = 0
    and
    =COUNTIF(B2:C101,"<125") =18

    Even if I filter BOTH columns on <125 (IE show only rows that contain <125 in BOTH columns), I get 3, not 2 as in your sample? Rows 56, 87 88

    Can you explain how you get 2?
    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

  9. #9
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Need a counting formula

    @ FDibbins

    It's the count of unique serial codes that fail the criteria, not the number of instances that fail.
    Hence the additional column in my suggestion in post#6

    @ Ferloft that isn't an extra table, it's just a couple of helper columns, truncated to keep the calcs to a minimum, if you need an instant result you will need to use VBa either as a macro or an UDF, a compounded formula will be unreasonably heavy on the workbook.

    We could re-jig the layout to use hidden columns if that suits you.

  10. #10
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Need a counting formula

    Try this. No helper columns or rows is required.

    Above 225:

    G2: =SUM(SIGN(FREQUENCY(IF((B$2:B$101>225)+(C$2:C$101>225)>0,MATCH(A$2:A$101,A$2:A$101,0)),MATCH(A$2:A$101,A$2:A$101,0))))

    Below 125:

    G3: =SUM(SIGN(FREQUENCY(IF((B$2:B$101<125)+(C$2:C$101<125)>0,MATCH(A$2:A$101,A$2:A$101,0)),MATCH(A$2:A$101,A$2:A$101,0))))


    **** Both formula are required: Press Ctrl+Shift+Enter, not just Enter ****

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Need a counting formula

    Well hush ma' mouth ...

    Nice one mama ..

    A word of caution, you can't simply extend the formulae depth by extending the ranges to safely cover your expected largest list of data.

    The formulae must cover the exact size of the list, any blank rows at the end of the table, or blanks in the serial codes, will cause the formulae to fail.

    To allow for this might I suggest you still use the dynamic names I suggested earlier.

    e.g.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    I have added mamas' solution to this workbook (the orange cells)
    Attached Files Attached Files
    Last edited by Marcol; 08-01-2013 at 03:29 AM.

  12. #12
    Registered User
    Join Date
    07-11-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Need a counting formula

    It looks like Mama's formulas are working but they are extremely slow. I did use the named ranges Marcol but it did not seem to help. I did not want to introduce VBA as that also tends to severely weigh down my spreadsheets.
    Last edited by Ferloft; 08-01-2013 at 09:05 AM.

+ 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. Replies: 6
    Last Post: 02-04-2012, 06:57 PM
  2. Counting formula
    By KINNEY0201 in forum Excel General
    Replies: 1
    Last Post: 10-05-2009, 08:56 PM
  3. Counting Formula....
    By ukgthor in forum Excel General
    Replies: 27
    Last Post: 08-27-2009, 06:11 AM
  4. [SOLVED] formula on counting
    By Michael A in forum Excel General
    Replies: 2
    Last Post: 01-06-2006, 11:52 AM
  5. [SOLVED] Help with counting formula
    By Ian in forum Excel General
    Replies: 1
    Last Post: 01-07-2005, 07:06 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