+ Reply to Thread
Results 1 to 11 of 11

How to count number of Xs in the last sequence Xs in a column

  1. #1
    Forum Contributor
    Join Date
    10-28-2014
    Location
    Sydney
    MS-Off Ver
    Professional 2010
    Posts
    151

    How to count number of Xs in the last sequence Xs in a column

    How to count the the last sequence of Xs in a column.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: How to count number of Xs in the last sequence Xs in a column

    Hi prudential,

    See if this formula does what you need after using a Helper Column.

    =LOOKUP(2,1/($A$1:$A$6="X"),($B$1:$B$6))

    Last X in Column Count String Helper.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    10-28-2014
    Location
    Sydney
    MS-Off Ver
    Professional 2010
    Posts
    151

    Re: How to count number of Xs in the last sequence Xs in a column

    Hi Marvin, thanks for your help. Is there a way to do with without a helper column?

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: How to count number of Xs in the last sequence Xs in a column

    Hi,

    If you knew the last string of X's was the largest number you might be able to use a Max function but I don't know of a way to do this problem without a helper. Maybe one of the smart Guru's will have a way?

  5. #5
    Forum Contributor
    Join Date
    10-28-2014
    Location
    Sydney
    MS-Off Ver
    Professional 2010
    Posts
    151

    Re: How to count number of Xs in the last sequence Xs in a column

    There's no way to start the count from when there was no X?

    Somthing similar to this - =LOOKUP(2,1/(A$1:$A$6<>""),$A1:$A$6)="X"
    Last edited by prudential; 05-07-2018 at 10:17 AM.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: How to count number of Xs in the last sequence Xs in a column

    Look at the formula in the helper column that does what I think you mean. Look at the different formula in B1 vs B2. I pulled the B2 column down to the bottom of the Column A rows.

  7. #7
    Forum Contributor
    Join Date
    10-28-2014
    Location
    Sydney
    MS-Off Ver
    Professional 2010
    Posts
    151

    Re: How to count number of Xs in the last sequence Xs in a column

    Thanks but I really wanted to avoid creating a separate column. Once i figure this out it solves a much bigger problem and I can close 2 threads as solved.

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

    Re: How to count number of Xs in the last sequence Xs in a column

    Here are two formulas. Select suitable for you. PL see file.

    =SUMPRODUCT(MATCH(2,1/(A1:A6="X"))-MATCH(2,1/(A1:A6<>"X")))

    =MAX(SUMPRODUCT(MATCH(2,1/(D1:D6="X"))-MATCH(2,1/(D1:D6<>"X"))),0)
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: How to count number of Xs in the last sequence Xs in a column

    Try this one without helper column
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: How to count number of Xs in the last sequence Xs in a column

    Hi kvsrinivasamurthy,

    Your first formula above doesn't work if the last letter in a column is a "Y". I also can't make the second formula work for me. To test I've changed your formulas to include the entire column A. Then add letters to the bottom of the rows and see if it agrees.

    Any improvements to your formulas? Am I missing something?

  11. #11
    Forum Contributor
    Join Date
    10-28-2014
    Location
    Sydney
    MS-Off Ver
    Professional 2010
    Posts
    151

    Re: How to count number of Xs in the last sequence Xs in a column

    Quote Originally Posted by AlKey View Post
    Try this one without helper column
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    AlKey,

    That's brilliant, thank you so much. That now solves this other problem as well.

    https://www.excelforum.com/excel-for...m-a-range.html
    Last edited by prudential; 05-07-2018 at 12:33 PM.

+ 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] Count the number of occurrence upto now and assign a unique sequence number
    By chathuranga in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-22-2016, 07:25 AM
  2. [SOLVED] VBA to count number in column and give number sequence in next column
    By saravanan1981 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2016, 09:38 AM
  3. Replies: 7
    Last Post: 06-08-2015, 08:39 AM
  4. [SOLVED] Count number of cells in sequence
    By cocacrave in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-28-2015, 08:20 PM
  5. Replies: 2
    Last Post: 10-11-2012, 02:54 PM
  6. Replies: 5
    Last Post: 11-22-2010, 06:31 PM
  7. count and display the next number in a sequence
    By chuck515 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-31-2008, 12:04 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