+ Reply to Thread
Results 1 to 4 of 4

calculating the number of appearances in certain threshold

  1. #1
    Registered User
    Join Date
    06-02-2023
    Location
    Germany
    MS-Off Ver
    2019
    Posts
    2

    calculating the number of appearances in certain threshold

    Hi,

    I have 2 columns.

    Column A has the number '0' and '1'.
    Column B contains random numbers.

    I need to calculate how many times the number '1' appear in column A for everytime the sum of the numbers in column B reach a certain treshold. Lets say the treshold is 100, I need to calculate how many times the number '1' appear in column A everytime the sum of the numbers in Column B reach 100.


    for example with a treshold of 100:

    A B
    0 25
    0 30
    1 15
    0 17
    1 20 <-- here the sum reaches 100 for the first time (107)
    1 10
    0 18
    1 17
    1 26
    1 20
    0 31 <-- here the sum reaches 100 for the second time (122)
    0 60
    1 50 <-- here the sum reaches 100 for the third time (110)
    ... ...

    In this case, the first treshold has 2 '1's, the second treshold has 4 '1's and the third treshold has 1 '1'. It would be great if the results are shown in a third column for example:

    Column C
    2
    4
    1
    ...

    Thank you in advance!

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

    Re: calculating the number of appearances in certain threshold

    Use a helper column to sovle it.

    C1=IF(B1>=100,0,B1)
    C2=IF(C1+B2>=100,0,C1+B2)
    copied down.

    D1
    Please Login or Register  to view this content.
    copied down.
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: calculating the number of appearances in certain threshold

    As an alternative, here is a VBA solution you can run on the active sheet;


    Please Login or Register  to view this content.
    If your Question is answered; please mark it SOLVED. If you are happy with a member's solution, say 'Thanks' and click the 'Star' to Add Reputation.

  4. #4
    Registered User
    Join Date
    06-02-2023
    Location
    Germany
    MS-Off Ver
    2019
    Posts
    2

    Re: calculating the number of appearances in certain threshold

    thank you so much! it works wonderfully!

+ 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: 1
    Last Post: 11-30-2016, 08:02 PM
  2. Count 1 ... N appearances of a number
    By dimpousis in forum Excel General
    Replies: 6
    Last Post: 03-20-2016, 02:25 PM
  3. Replies: 2
    Last Post: 05-27-2014, 02:53 PM
  4. [SOLVED] Help please! counting number of appearances
    By Andje in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-14-2012, 09:14 AM
  5. insert row and sum number of appearances
    By ciprian in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-03-2011, 05:55 AM
  6. Calculating the difference over a threshold
    By kmlloyd in forum Excel General
    Replies: 7
    Last Post: 12-14-2010, 05:41 PM
  7. Help sorting by number of appearances in a column
    By perkowski in forum Excel General
    Replies: 1
    Last Post: 01-28-2010, 12:33 PM

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