+ Reply to Thread
Results 1 to 7 of 7

Count letter "W" in the last 5 entries

  1. #1
    Registered User
    Join Date
    02-09-2009
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    49

    Count letter "W" in the last 5 entries

    Hi,
    I want to count how many "W" are in the last 5 data entered. How can I do this? See attached sheet as an example - need to count the "w" in column C.
    Attached Files Attached Files
    Last edited by bmind; 07-13-2009 at 11:55 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Count letter "W" in the last 5 entries

    Does that data truly represent all the hurdles to be overcome? How about a dataset twice as long and fill in your expected results, just to be sure we understand your need. It appears a simple worksheet formula in D5 of:

    =COUNTIF(C1:C5,"W")
    ...then copy that cell downward....does that do what you want?


    If the "July" entry is in the way, perhaps you can simply move that out to the next column over and tuck the values up so they continue sequentially.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Count letter "W" in the last 5 entries

    how about moving july as suggested then
    =COUNTIF(OFFSET(INDIRECT(ADDRESS(MATCH("*",$C$1:$C$200,-1),3)),-4,,5),"W")
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    02-09-2009
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Count letter "W" in the last 5 entries

    Quote Originally Posted by JBeaucaire View Post
    Does that data truly represent all the hurdles to be overcome? How about a dataset twice as long and fill in your expected results, just to be sure we understand your need. It appears a simple worksheet formula in D5 of:

    =COUNTIF(C1:C5,"W")
    ...then copy that cell downward....does that do what you want?


    If the "July" entry is in the way, perhaps you can simply move that out to the next column over and tuck the values up so they continue sequentially.
    Thanks for quick reply. There are a few hurdles with this, it is not as is easy as it looks.
    1. Empty space can not be deleted as data is downloaded from website and there are more then 300 sheets and have the data moved somewhere else without space is something i would like to avoid (if I can).
    2. The formula (to count) will only be in a specific cell (can not change location as it will be used for another calculation.
    3. When data updates from web query then more rows will be added. Formula should count "W" only in the last 5 entries (empty space does not count as an entry).

    For example in the test sheet supplied, enter a formula in D5 so that when I keep adding (manually if you will) data and empty cells in column C it will calculate the number of "W" in the last 5 entries (not counting empty cells).

    I hope there is more clarity now.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Count letter "W" in the last 5 entries

    See Martin's answer in post #3. I think that does what you want.

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,698

    Re: Count letter "W" in the last 5 entries

    Perhaps try this array formula

    =SUM((ROW(C1:C100)>=LARGE(IF(C1:C100<>"",ROW(C1:C100)),5))*(C1:C100="W"))

    confirmed with CTRL+SHIFT+ENTER

  7. #7
    Registered User
    Join Date
    02-09-2009
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Count letter "W" in the last 5 entries

    Quote Originally Posted by daddylonglegs View Post
    Perhaps try this array formula

    =SUM((ROW(C1:C100)>=LARGE(IF(C1:C100<>"",ROW(C1:C100)),5))*(C1:C100="W"))

    confirmed with CTRL+SHIFT+ENTER
    This works perfect. Thanks a lot for your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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