+ Reply to Thread
Results 1 to 5 of 5

Sumif, Averageif, Countif, From a range

  1. #1
    Registered User
    Join Date
    09-21-2004
    Posts
    37

    Sumif, Averageif, Countif, From a range

    I'm trying to get the below to work, I'm tired and can't really tell if it should work or i've missed something simple :P


    =COUNTIF(codejan07,MID(codejan07,12,1)="P")

    So what I have is 10000 rows of data and one column (codejan07) has a 20 digit code. I need to count how many of those 10000 lines has the letter P in position 12 of the code. I know I can do this by adding another column but I would like to have it all in one cell..

    Any ideas, can it be done or do I have to resort to plan "B"

    Cheers

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

    =COUNTIF(codejan07,REPT("?",11)&"P"&"*")

    or

    =SUMPRODUCT(--(MID(codejan07,12,1)="P"))
    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
    09-21-2004
    Posts
    37
    =SUMPRODUCT(--(MID(codejan07,12,1)="P"))
    Works a treat, thanks very much..

    Ok, next step is not going to be as easy as I thought now.

    In column G I have values. What I need to do is average the cost of G where "codejan07" = "P"..
    Last edited by Odysseus; 09-09-2008 at 08:48 AM.

  4. #4
    Registered User
    Join Date
    09-21-2004
    Posts
    37
    Anyone able to help with my 2nd part there? I've tried and failed

    Cheers

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    =SUMPRODUCT(--(MID(codejan07,12,1)="P"),columnGRange)/SUMPRODUCT(--(MID(codejan07,12,1)="P"))


    or =Average(If(MID(codejan07,12,1)="P",columnGRange) which needs to be confirmed with CTRL+SHIFT+ENTER not just ENTER.

    Note: ColumnGRange must be same size as codejan07 range.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Sumif using date range
    By taherno1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-10-2008, 12:16 PM
  2. Resetting Spreadsheet Data Entry Cells
    By acg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-21-2007, 02:08 PM
  3. Countif (Number of values in a range)
    By braydon16 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-20-2007, 06:19 PM
  4. Countif and non adjacent cells range
    By isouaga in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-18-2007, 08:48 AM
  5. Sumif value is in a different range
    By Toril in forum Excel General
    Replies: 1
    Last Post: 05-11-2007, 12:50 PM

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