+ Reply to Thread
Results 1 to 4 of 4

Average with multiple conditions but only when occur in a sequence

  1. #1
    Registered User
    Join Date
    02-02-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Average with multiple conditions but only when occur in a sequence

    Hi,

    I would like to create a formula that would average a range with multple criteria but specifically only when conditions are in a sequence, hope that makes sense. So instead an average if over the whole range, only do it over the range where the conditions are met.

    So in the Run Cost Average column i'd like to average the Color and if the status is "Run". If the next row has the same colour i'd like to include that in the average but as soon as the colour changes in the sequence or one has not run the average stops.

    I have tried and failed with multiple helper cells

    Hopefully that makes sense

    *uploaded excel file example

    Color Status Cost Run Cost Average
    Red Not Run 5
    Red Run 10 7.5
    Red Run 5 7.5
    Blue Run 5 5
    Red Not Run 5
    Red Run 15 15
    Attached Files Attached Files
    Last edited by Edgie; 07-20-2020 at 05:47 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,451

    Re: Average with multiple conditions but only when occur in a sequence

    The yellow banner has instructions on how to add a sheet

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Average with multiple conditions but only when occur in a sequence

    I used 4 helpcolumns to get the result.

    After that a pivot table.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: Average with multiple conditions but only when occur in a sequence

    Please try at D2

    =IF(B2="Run",AVERAGE(INDEX(C$2:C2,MATCH(2,INDEX(1/(1-(A$1:A2=A2)*(B$1:B2=B2)),))):INDEX(C2:C10,MATCH(1,INDEX(1-(A2:A10=A2)*(B2:B10=B2),),)-1)),"")
    Attached Files Attached Files

+ 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. Formula to count if 2 conditions occur
    By Stufft in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-16-2016, 08:10 AM
  2. How can I have an email automatically sent to me if two conditions occur?
    By ccb12 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-09-2016, 04:54 AM
  3. Average of first two values in row, wherever they occur
    By KSliter in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-02-2015, 06:21 AM
  4. Replies: 5
    Last Post: 07-23-2014, 12:46 PM
  5. Average with multiple conditions
    By Littleoladywho in forum Excel General
    Replies: 6
    Last Post: 06-25-2012, 12:13 PM
  6. Instances that occur in a sequence
    By timmycl_7 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 03-20-2008, 09:19 AM
  7. [SOLVED] Return Value If Two Conditions occur
    By Hatman in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-30-2006, 04:35 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