+ Reply to Thread
Results 1 to 5 of 5

formula to find a mean over a range based on two criterias

  1. #1
    Registered User
    Join Date
    08-15-2010
    Location
    melbourne, australia
    MS-Off Ver
    Excel 2007
    Posts
    39

    formula to find a mean over a range based on two criterias

    hello, I need some help here:
    basically what i have now is 70,000 observations of assets of companies in different years in diff industry (industry is represented by 4-digits sic code), what i want is a formula that could give me a mean of the assets in each year in each industry. But what makes it more complicated is that the criteria I use for SIC is only the first two digits
    for example:
    company fyear assets SIC
    A 2000 10 1222
    B 2001 20 1234
    D 2000 30 1233
    C 2000 40 1345
    E 2001 50 1234
    F 2000 60 1356

    I need the result to be
    fyear first 2 digits SIC average of assets
    2000 12 20
    2001 12 35
    2000 13 50

    ideas ?? thank you !!
    Last edited by NBVC; 09-08-2010 at 02:14 PM.

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

    Re: formula to find a mean over a range based on two criterias

    Create a helper column with the 2-digit SIC with formula

    =Left(C2,2)+0

    copied down where Column C is your 4-digit SIC column

    Then create a Pivot Table from the year, Qty and 2-digit SIC column

    Drag the year and 2-Digit SIC into the Row data area (in that order) and then drag the Qty to the Data (Sigma) area.
    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
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: formula to find a mean over a range based on two criterias

    If your data is in B2:D100 then you could use AVERAGEIFS like this in H2 copied down

    =AVERAGEIFS(D$2:D$100,B$2:B$100,F2,C$2:C$100,">="&G2*100,C$2:C$100,"<"&(G2+1)*100)

    where F2 contains a specific year and G2 the 2 digit code
    Audere est facere

  4. #4
    Registered User
    Join Date
    08-15-2010
    Location
    melbourne, australia
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: formula to find a mean over a range based on two criterias

    @NBVC and daddylonglegs
    thanks for the formula, in the end I use pivot table because it seems easier to implement

    but I have one question: is there a reason why I should drag year first ? i mean its just the same if i drag sic first right ? its just the layout will be different ?

    thank you

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

    Re: formula to find a mean over a range based on two criterias

    Exactly, the layout would be different, it is your choice... to mimic the results you want, you would drag the year first,.. It will sort by year first, then group the SICS for each year...

    It you drag SIC first, you will get all the SICs listed and then each one will be broken down by year..

    .. whatever your preference, experiment with it.

+ 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