Excel User Group
Microsoft Excel blogs, forums, files. Read, ask questions, provide answers.

formula to count cells that shart with text

Latest post Wed, Jul 1 2009 3:40 PM by hymdt. 4 replies.
  • Thu, Jun 18 2009 11:52 AM

    • jeepjenn
    • Top 150 Contributor
    • Joined on Fri, Jan 30 2009
    • Posts 5
    • Points 105

    formula to count cells that shart with text

    I have a spreadsheet that lists patients Health Card numbers. The difference between Ontario health card numbers and Quebec health card numbers, is that Quebec card numbers contain 4 letters at the beginning instead of numbers followed by letters like the Ontario ones.

    I have my list starting in column H1 to H1500

    I need to find a formula that will let me count the cells that start with text.

    Any ideas would be welcomed as I have spent most of this morning trying to figure out something!

     

    Thanks,

     

    Jeepjenn

    • Post Points: 21
  • Thu, Jun 18 2009 5:38 PM In reply to

    • Nick Hodge
    • Top 10 Contributor
    • Joined on Sun, Dec 23 2007
    • Southampton
    • Posts 500
    • Points 8,600
    • MVP

    Re: formula to count cells that shart with text

    Could I presume that Ontario ones are all numbers? If so you could use something like

    =SUM(ISTEXT($H$1:$H$1500)*1)

    This is an array formulae so needs to be entered using Ctrl+Shift+Enter

    If not I would maybe use a helper column to strip the first four letters off, using =LEFT(xx,4) and work with that. Post back if you need further help

    Regards
    Nick Hodge
    Microsoft MVP, Excel
    Southampton, UK

    • Post Points: 21
  • Fri, Jun 19 2009 12:52 PM In reply to

    Re: formula to count cells that shart with text

    In this particular instance, would it be okay to just test for the first character being non-numeric?

     

    =SUMPRODUCT(--($H$2:$H$20<>""),--(NOT(ISNUMBER(--(LEFT($H$2:$H$20,1))))))

    Regards

    Bob

    • Post Points: 21
  • Tue, Jun 30 2009 10:03 PM In reply to

    • jeepjenn
    • Top 150 Contributor
    • Joined on Fri, Jan 30 2009
    • Posts 5
    • Points 105

    Re: formula to count cells that shart with text

    BOB! You are a genius!  Thanks for the help!

    • Post Points: 21
  • Wed, Jul 1 2009 3:40 PM In reply to

    • hymdt
    • Not Ranked
    • Joined on Wed, Jul 1 2009
    • Posts 1
    • Points 5

    Re: formula to count cells that shart with text

    that would work either:

     

    =COUNTA(H1:H1500)-COUNT(H1:H1500)

     

    GOOD LUCK..

    • Post Points: 5
Page 1 of 1 (5 items) | RSS
Copyright Excel User Group and the relevant contributors, 2009. All Trade Marks acknowledged. This site is a peer-to-peer site and NOT affiliated in any way to Microsoft Corp. All rights reserved.