+ Reply to Thread
Results 1 to 13 of 13

how do I only count a value in a range that starts with "900"

  1. #1
    Registered User
    Join Date
    07-18-2012
    Location
    JHB, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    8

    Cool how do I only count a value in a range that starts with "900"

    I have a range of invoice numbers which changes to credit note numbers, in the same column. I need to only count the credit notes.
    The invoice numbers start with 120.. numbers, and the credit notes with 900... numbers.
    Can someone please help me?

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: how do I only count a value in a range that starts with "900"

    Try possibly:

    =COUNTIF(A:A,"120*")

    or if the 120 is a cell, like D1, then =COUNTIF(A:A,D1&"*")
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    07-18-2012
    Location
    JHB, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: how do I only count a value in a range that starts with "900"

    Thank you, but it's giving me a 0 value? What could be wrong?

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: how do I only count a value in a range that starts with "900"

    Probably column A are "real numbers" instead of text strings...

    Try instead:

    =SUMPRODUCT(--(LEFT(A2:A100&"",3)="120"))

    adjust range to suit.

  5. #5
    Registered User
    Join Date
    07-18-2012
    Location
    JHB, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: how do I only count a value in a range that starts with "900"

    I think i am getting there, but now it's giving me a "TRUE" Value?

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: how do I only count a value in a range that starts with "900"

    What is the exact formula you are using?

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

    Re: how do I only count a value in a range that starts with "900"

    Quote Originally Posted by Wildboer View Post
    The invoice numbers start with 120.. numbers, and the credit notes with 900... numbers.
    Is there a fixed number of digits? Assuming 6 digit numbers (adjust as required) you could use COUNTIFS like this

    =COUNTIFS(A:A,">=120000",A:A,"<=120999")
    Audere est facere

  8. #8
    Registered User
    Join Date
    07-18-2012
    Location
    JHB, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: how do I only count a value in a range that starts with "900"

    =SUMPRODUCT(--(LEFT(C2:C999,3)="900"))
    I used this basic formula to count amount of invoices: =COUNTA(B2:B1000)

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: how do I only count a value in a range that starts with "900"

    You are missing a little piece....

    =SUMPRODUCT(--(LEFT(C2:C999&"",3)="900"))

    also, have a look at daddylonglegs' suggestion....

  10. #10
    Registered User
    Join Date
    07-18-2012
    Location
    JHB, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: how do I only count a value in a range that starts with "900"

    Still getting either true or false values?
    I also tried this : =IF(C2>"90000000",COUNTA(C2:C999),"no credit notes"), and I get a "no credit notes value")
    900000599 - example of credit note nr
    12743448 - example of invoice number

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: how do I only count a value in a range that starts with "900"

    I am not sure how my Sumproduct formula would give TRUE or FALSE result.. it would be numerical or an error!

    with your version, you would need to remove the quotes around the number... but that will count all numbers in C2:C999 if C2 is bigger, not if all are bigger...

    you can possibly try:

    =COUNTIF(C2:C999,">=90000000") to count all number greater than 90000000

  12. #12
    Registered User
    Join Date
    07-18-2012
    Location
    JHB, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: how do I only count a value in a range that starts with "900"

    Thank you for your effort. Still getting "false". I think i'll create another column, to display wether or not the number is above 900..., and then count the true values?

    ---------- Post added at 04:18 PM ---------- Previous post was at 04:13 PM ----------

    I realized that although it's giving me a false value, it gives the right answer where I use the cell reference in my formulas in the other sheets!

  13. #13
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: how do I only count a value in a range that starts with "900"

    I wonder how you have the cell showing False formatted?

+ 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