+ Reply to Thread
Results 1 to 10 of 10

Formula required to count number of records

  1. #1
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Question Formula required to count number of records

    Hi,

    what I have is a worksheet with a 'Business Group' column and an 'Observation' column

    The 'Business Group' column can have data for five diffrent offices i.e.

    East Office
    Head Office
    North Office
    South Office
    West Office

    and the 'Observation' column having data i.e.

    F= Fail
    O = Out of period
    P = Pass
    R = Risk"

    What I'm trying to do is to automatically calulate the totals for each 'Business Group' and 'Observation' in the summary tabel D1:I7 possible via sumif or vlookups etc

    Office Fail = F Out of Period = 0 Pass = P Risk = R Total
    East Office 2 2 4 4 12


    I have attached an example file to demonstate my requirements

    Many thanks in advance - Excel version 2007


    Regards

    Rob
    Attached Files Attached Files
    Rob

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

    Re: Formula required to count number of records

    Hello Rob,

    If you change the headers in E1:H1 to show just the single letter that matches your data, i.e. F, O, P and R then you can put this formula in E2 and copy it across and down the whole table

    =COUNTIFS($B:$B,$D2,$C:$C,E$1)
    Audere est facere

  3. #3
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Formula required to count number of records

    youll want to use a countifs function, your first one (east office, F) would be countifs($B$12:$B$89,$D1,$C$12:$C$89,"F") you can drag down and over from there and just change "F" to your other letter. let nme know how this works for you
    Regards,
    amotto

    If I helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  4. #4
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Formula required to count number of records

    If you changed your headings to just F, O, P and R, then you can use this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Else you can use this, but you need to change the 0 (zero) in F1 to an O:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    For both formulas you'd want to put them in E2 and copy down and across.
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

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

    Re: Formula required to count number of records

    Note: you could still use COUNTIFS even with the headers unchanged (except 0 to O), i.e.

    =COUNTIFS($B:$B,$D2,$C:$C,RIGHT(E$1))

  6. #6
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Formula required to count number of records

    Ahh, thanks for pointing that out daddylonglegs! In that case my second formula is superflous (unless you're using a version of Excel older than 2007 of course).

  7. #7
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Re: Formula required to count number of records

    Guys,

    many thanks for all your responses they are very much appreciated.

    I've just noticed that in Column C if have input O and in F1 I have put a 0 (zero) when in fact F1 should have been a O.

    That said. I have tried all the formulas in E2 but with the exception of Søren's second formula they all return #NAME?, however, Søren's second formula works as required.

    I'm not sure why #NAME? is being displayed but would be grateful if you guys could amend and re-load my example.xls to see where I’m going wrong

    Once again many thanks to one all for your responses

    Best Regards


    Rob

  8. #8
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Formula required to count number of records

    The reason why you get the error is probably that you are using a version of Excel older than 2007, and thus =COUNTIFS() (and others) is unavailable to you.

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

    Re: Formula required to count number of records

    but.....from post 1

    Quote Originally Posted by robertguy View Post
    Excel version 2007

  10. #10
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Re: Formula required to count number of records

    Søren,

    I've just realised I used my works PC which is running 2007 to create and post my Example file and when i got home I downloaded my Example file and tested the formulas on my home PC which is running 2003

    Rob

+ 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