+ Reply to Thread
Results 1 to 15 of 15

Count the ordered frequency/sequence of 0 and 1

  1. #1
    Registered User
    Join Date
    02-03-2021
    Location
    Sweden, Gothenburgh
    MS-Off Ver
    365
    Posts
    8

    Count the ordered frequency/sequence of 0 and 1

    Hi,

    I need help to count the Frequency (sequence) of 0 and 1 in a row. My data looks like this (e.g):

    1, 0, 0, 1, 0, 0, 0, 1, 1, 1.

    and I want the output to be:

    1, 2, 1, 3, 3.

    another example:

    1, 1, 1, 0, 0, 0,

    and I here want the output to be:

    3, 3,

    Many thanks! and hope I made myself clear

    Note: If it´s possible to show which frequency/sequence number that belongs to 0 or 1 is a bonus, but not necessary.
    Attached Files Attached Files
    Last edited by Sumsar93; 02-04-2021 at 02:59 AM. Reason: Add attachment

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Count the ordered frequency/sequence of 0 and 1

    Please read the yellow banner at the top of this page on how to attach a file.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    02-03-2021
    Location
    Sweden, Gothenburgh
    MS-Off Ver
    365
    Posts
    8

    Re: Count the ordered frequency/sequence of 0 and 1

    Thanks,

    I no attached a file to the question.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Count the ordered frequency/sequence of 0 and 1

    Excel says file is corrupted. Would not open

  5. #5
    Registered User
    Join Date
    02-03-2021
    Location
    Sweden, Gothenburgh
    MS-Off Ver
    365
    Posts
    8

    Re: Count the ordered frequency/sequence of 0 and 1

    Sorry for that now it should work.

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Count the ordered frequency/sequence of 0 and 1

    Please try
    =TRANSPOSE(FILTER(FREQUENCY(COLUMN(G10:R10),COLUMN(G10:R10)/(G10:R10<>H10:S10)),FREQUENCY(COLUMN(G10:R10),COLUMN(G10:R10)/(G10:R10<>H10:S10))))

    or with LET
    =LET(a,FREQUENCY(COLUMN(G10:R10),COLUMN(G10:R10)/(G10:R10<>H10:S10)),TRANSPOSE(FILTER(a,a)))
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-03-2021
    Location
    Sweden, Gothenburgh
    MS-Off Ver
    365
    Posts
    8

    Re: Count the ordered frequency/sequence of 0 and 1

    Hi, I tried to use the formulas but it wont work, I attach an example. It says the formula uses unrecognised text.

    Best regards,

    rasmus
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Count the ordered frequency/sequence of 0 and 1

    code for UDF FrequncyArray
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 02-04-2021 at 04:39 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  9. #9
    Registered User
    Join Date
    02-03-2021
    Location
    Sweden, Gothenburgh
    MS-Off Ver
    365
    Posts
    8

    Re: Count the ordered frequency/sequence of 0 and 1

    Thank you very much, It worked perfect! Is it possible to get the ouput in separate cells?

  10. #10
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Count the ordered frequency/sequence of 0 and 1

    If result is required in different cells instead of Function macro is required. Are you ok with it.
    code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 02-04-2021 at 08:01 AM.

  11. #11
    Registered User
    Join Date
    02-03-2021
    Location
    Sweden, Gothenburgh
    MS-Off Ver
    365
    Posts
    8

    Re: Count the ordered frequency/sequence of 0 and 1

    Okay, then it´s fine. Thank you!

  12. #12
    Registered User
    Join Date
    02-03-2021
    Location
    Sweden, Gothenburgh
    MS-Off Ver
    365
    Posts
    8

    Re: Count the ordered frequency/sequence of 0 and 1

    Hi again,

    The freq array seems to give the wrong output when the sequence ends with 2 unequal numbers (010, 101) plz, see the attached example file.

    Would really appreciate help with this, since my calculations rely on this to work.

    Regards,

    Rasmus Johansson
    Attached Files Attached Files
    Last edited by Sumsar93; 02-21-2021 at 02:03 PM.

  13. #13
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Count the ordered frequency/sequence of 0 and 1

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

  14. #14
    Registered User
    Join Date
    02-03-2021
    Location
    Sweden, Gothenburgh
    MS-Off Ver
    365
    Posts
    8

    Re: Count the ordered frequency/sequence of 0 and 1

    thanks works perfectly now!

  15. #15
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Count the ordered frequency/sequence of 0 and 1

    Try

    G3
    =TEXTJOIN(",",,TEXT(FREQUENCY(COLUMN(C3:E3),IF(C3:D3<>D3:E3,COLUMN(C3:D3))),"0;;"))

    E18
    =TEXTJOIN(",",,TEXT(FREQUENCY(COLUMN(G18:M18),IF(G18:L18<>H18:M18,COLUMN(G18:L18))),"0;;"))

    or UDF

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

+ 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: 4
    Last Post: 05-22-2020, 05:03 PM
  2. [SOLVED] Count if there is a new order/ sum if there are multiple items being ordered by one person
    By sweetlakia in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-28-2016, 02:50 PM
  3. [SOLVED] Count If Function To Count Frequency Of Long Numbers
    By RowanB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2013, 05:18 AM
  4. Replies: 1
    Last Post: 01-08-2013, 09:30 AM
  5. Hi! I need to count dishes ordered per table ...see attachment.
    By jbpianoman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-07-2012, 01:38 PM
  6. How to determine Data sequence and Frequency
    By grudum in forum Excel General
    Replies: 12
    Last Post: 10-27-2010, 10:41 AM
  7. Count Frequency?
    By melnikok in forum Excel General
    Replies: 2
    Last Post: 01-21-2008, 03:11 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