+ Reply to Thread
Results 1 to 7 of 7

Counting Function referencing both numbers and phrases

  1. #1
    Registered User
    Join Date
    01-09-2012
    Location
    Alaska
    MS-Off Ver
    Excel 2003
    Posts
    4

    Post Counting Function referencing both numbers and phrases

    I am attempting to craft a spreadsheet that will count certain numbers in columns when a phrase appears in another column but same row.

    The essential information is in two Columns, A & B. Column A will list words such as "ABC", "Water", "PK". Column B will list years.

    For example, I want to count how many times 2004 appears where ABC is in the same row.

    I can then modify the formula to count how many "ABC" there are or sort by different years.


    I have used countif for sorting this information by a single variable, i just don't know how to do it for multiple variable in multiple columns or cells. This spreadsheet is approx. 300 rows. Any help is appreciated. Thanks.
    Last edited by akhockey; 01-09-2012 at 07:43 PM.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Counting Function referencing both numbers and phrases

    With your lists in Col_A and Col_B
    and
    C1: a word to find....ABC
    D1: a year to find.....2004

    This regular formula returns the count of that combination:
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    01-09-2012
    Location
    Alaska
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting Function referencing both numbers and phrases

    Not so much as it does not check if ABC is in the same row. All that function does is add the two occurances together.

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Counting Function referencing both numbers and phrases

    Hello akhockey,

    Did you try exactly as Ron said? That will give you the count.

    A2:A300 contains words,
    B2:B300 contains years

    C1, Enter ABC
    D1, Enter 2004

    Then,

    =SUMPRODUCT((A2:A300=C1)*(B2:B300=D1))

    This will count both ABC & 2004 are in same row in respective column.. If you have dates in Col_b & formatted as yyyy, then this wouldn't work.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  5. #5
    Registered User
    Join Date
    01-09-2012
    Location
    Alaska
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting Function referencing both numbers and phrases

    Nope, i didn't try it exactly. I was putting in the 'year' or 'ABC' inside the formula and it was kicking out errors and wrong numbers. This works now, i'll need to figure a way to reference the year, as this information is going under a column that is labeled for when service needs to be performed (aka a future year, not the year it was last done). I appreciate the help and the clarification.

  6. #6
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Counting Function referencing both numbers and phrases

    FYI, You can also use Pivot Table.

  7. #7
    Registered User
    Join Date
    01-09-2012
    Location
    Alaska
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting Function referencing both numbers and phrases

    I don't know anything about Pivot Tables yet but i'll probably end up learning them due to this and some other upcoming projects. thanks again for the assistance. the solution ended up being much simpler than I thought it would.

+ 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