+ Reply to Thread
Results 1 to 6 of 6

iferror when calculating historical average of row, return an average of similair row.

  1. #1
    Registered User
    Join Date
    05-24-2012
    Location
    atlanta
    MS-Off Ver
    Excel 2010
    Posts
    45

    iferror when calculating historical average of row, return an average of similair row.

    So, calculating a very simple forecast, being an average of historicals.

    Problem is, some products have no history, so the history is all null.

    In this case, Id like to pull an average of other products produced at the same location.

    something like this. assume its the 1st of march, and jan and feb are actual data, forecasting march.
    Please Login or Register  to view this content.
    What I want it to do is say, ok, so no data for B, iferror takes care of that.

    Then we will take an average of other products from Chicago, return "7.5"

    I tried just doing an averageif, but the problem is, it find itself, so it creates a circular reference... I could manually exclude its own row, but thats tedious and will surely break down the road.

    Is there a better way? maybe averageifs and include (=plant, <>product)?

    edit: tried my own suggestion, looks like I may need to rethink the logic. even if I exclude itself, when there are 2 products with no data, they look to each other to find an average based on the other. No bueno.

    Edit 2- Instead of averaging the column of averages, I am attempting to average the source data that should not circle back.

    Please Login or Register  to view this content.
    Tried that, where D6:K37 is the previous data, A6 is product, B6 is Plant. Their respective criteria range are the labels.

    It returns #Value though.
    Last edited by bauerbach; 06-19-2012 at 03:55 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: iferror when calculating historical average of row, return an average of similair row.

    Hi,
    Does this work?

    =IF(ISERROR(AVERAGE(C2:D2)),OFFSET(B2,MATCH(B2,$B$3:$B$4,0),3),AVERAGE(C2:D2))

    This assumes that the data for the same site will be below the one giving an error.

    HTH
    Steve

  3. #3
    Registered User
    Join Date
    05-24-2012
    Location
    atlanta
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: iferror when calculating historical average of row, return an average of similair row.

    unfortunately the data is sorted by product, not by plant, so I cant rely on the order of the data, needs to search it out.

    also, due to future expansion needs, it must be a fillable formula, it cannot be customized for each product.

  4. #4
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: iferror when calculating historical average of row, return an average of similair row.

    Hi,

    How about this array formula?

    =IF(ISERROR(AVERAGE(C2:D2)),AVERAGE(IF($B$2:$B$8=B2,IF($C$2:$D$8<>0,$C$2:$D$8,""))),AVERAGE(C2:D2))

    This will average all products from the plant in B (excluding zeros) if the average of a particular row returns an error. You can add other "IF"s to the "AVERAGE(IF" formula as well (product).

    Commit the formula with Ctrl+Shift+Enter.

    HTH
    Steve

  5. #5
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: iferror when calculating historical average of row, return an average of similair row.

    You can also allow the circular reference by enabling the iterative calculation. Go to the Excel Options+Formulas and select enable iteratice calculation.

    Steve

  6. #6
    Registered User
    Join Date
    05-24-2012
    Location
    atlanta
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: iferror when calculating historical average of row, return an average of similair row.

    I *think* that will work. Ill try some testing, I was futzing around with array formulas infact, but hadnt quite landed on the right one.



    Thank you

+ 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