+ Reply to Thread
Results 1 to 3 of 3

Using Countif with another functions

  1. #1
    Registered User
    Join Date
    06-30-2004
    Posts
    9

    Using Countif with another functions

    I am trying to write a report using the COUNTIF function but in order to accomplish what the function needs to do, I need to use it with another function. Here is what I am trying to do:

    I have a worksheet that is my data table and a worksheet that is my report.
    I have a attached a visual to make this more clear. I am trying to count in the report the number of occurrences in the data table for 1A, 1B, etc for all rows that have Region # 0691 as 0691 is the region # for Chicago. There is more than 1 "region" that I need to do this for. I tried to use an IF statement and then embed a COUNTIF statement into that but it did not work as it returned a count of all cells that had 1A, not just the ones with Region # 0691. If anyone has any suggestions please let me know. I am trying to do this without using hidden cells or adding more worksheets. Thanks in advance for the help.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    try this array:
    =SUM(IF(range_of_status_code=A8,IF(range_of_Region#=A18,1,0),0))

    cell A8 contains status code and cell A18 contains Region# as shown in image.
    put appropriate ranges to above formula and press Ctrl+Shift+Enter (pressing only Enter will not work as this is any array formula)

    hope this would serve your purpose.

    Quote Originally Posted by garungaha1
    I am trying to write a report using the COUNTIF function but in order to accomplish what the function needs to do, I need to use it with another function. Here is what I am trying to do:

    I have a worksheet that is my data table and a worksheet that is my report.
    I have a attached a visual to make this more clear. I am trying to count in the report the number of occurrences in the data table for 1A, 1B, etc for all rows that have Region # 0691 as 0691 is the region # for Chicago. There is more than 1 "region" that I need to do this for. I tried to use an IF statement and then embed a COUNTIF statement into that but it did not work as it returned a count of all cells that had 1A, not just the ones with Region # 0691. If anyone has any suggestions please let me know. I am trying to do this without using hidden cells or adding more worksheets. Thanks in advance for the help.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,695
    Try this formula in B8 copied down

    =SUMPRODUCT(--(status_range=A8),--(region_range=A$18))

    status_range and region_range should be the same size and not whole columns

+ 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