+ Reply to Thread
Results 1 to 15 of 15

Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

  1. #1
    Registered User
    Join Date
    06-04-2021
    Location
    USA
    MS-Off Ver
    2010
    Posts
    13

    Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    Good Morning,

    This is my first post, but have already learned so much from going through other posts on this forum. I always considered myself pretty handy when it came to excel, that is until i came to this forum and saw even more in depth coding. Thank you so much for all that you have already shown me and helped me with. But i have come upon one that i either cant wrap my mind around, or my mind is so fried from trying so many different formulas and not being able to come up with a solution.

    Now for the problem:

    I have a report that i pull and typically go through it manually each time and get the data i need from. This downloaded sheet "Motor KPI" has thousands of data points ranging from Column A-DD & can have anywhere to 100-3000+ Rows. I usually filter the top row and then just select the certain Operators and Rigs and then find the data i need and average it to get what i need.

    I am wanting to create a workbook, that i can copy and paste the "Motor KPI" Sheet into and then in the "Avg ROP" sheet i type in the specific Operator & Rig in Columns A-B, then it auto filters the multiple sections based off the typed in Operator and Rig and filters through the "Phases" and then three additional sections based off the phase type , thus averaging each section from the Motor KPI sheet

    Out of all the columns only 6 are needed to be filtered on Motor KPI Sheet:
    Column A (Operator)
    Column B (Rig)
    Column Q (Rotate ROP)
    Column R (Slide ROP)
    Column S (Avg ROP)
    Column CS (Phases) - Multiple Phases that Columns Q,R&S based off of. ( SUR: Surface, INT: Intermediate, INT2: Intermediate 2, INT2: Intermediate 2 / CRV: CURVE, CRV/LAT: CURVE/LATERAL, LAT: Lateral)

    Then on Avg ROP Sheet
    Column A (Operator) - Manually type in otherwise leave all data following blank if nothing typed in
    Column B (Rig) - Manually type in otherwise leave all data blank if nothing typed in
    Column D1 (Selected Phase)- Find all the rows in "Motor KPI" sheet that have SUR: Surface (Column CS) and then find the multiple selected data from columns Q, R, & S under selected phase and average the multiple rows of selected data in D3:F3
    Column H1:X1 - Perform the same as above for each selected phase and sub category.
    Column AB - Average all rows for selected operator/rig.

    Im ok with using formulas, vba coding, or macros.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    In D4

    =IFERROR(AVERAGEIFS('Motor KPI'!Q$2:Q$22,'Motor KPI'!$A$2:$A$22,$A4,'Motor KPI'!$B$2:$B$22,$B4,'Motor KPI'!$CS$2:$CS$22,$D$1),"")

    Copy across to F and down

    Same formula for other phase: change $D$1 to appropriate "phase" in row 1
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    06-04-2021
    Location
    USA
    MS-Off Ver
    2010
    Posts
    13

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    John, thank you very much for such a quick reply and solution. I have been banging my head against the wall for a couple days not way overthinking the needed formula. Funny enough, i even had very similar to the one you provided written down, just kept over looking it. I definitely owe you the beverage of your choice if you ever find you way to Texas. Thank you again.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    You're welcome.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  5. #5
    Registered User
    Join Date
    06-04-2021
    Location
    USA
    MS-Off Ver
    2010
    Posts
    13

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    Yes sir i already did both of those. Thank you again.

  6. #6
    Registered User
    Join Date
    06-04-2021
    Location
    USA
    MS-Off Ver
    2010
    Posts
    13

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    John,

    Actually just realized something. I need it to look for the last row over all in all need sections in the Motor KPI tab, When i pull a fresh report it can have either 25 lines, or over a couple thousand lines of data. I will then copy and paste that report into an empty tab.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    Easiest way is to change the range (from 22) to your likely maximum e.g. 2000

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    Added examples of new criteria: check columns P and X

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    06-04-2021
    Location
    USA
    MS-Off Ver
    2010
    Posts
    13

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    This example works to an extent. I am wanting it to instead of looking for the exact copy of the phrase in P1, it look for the key words "Intermediate / Curve." So that if it does have the INT2: Intermediate 2 in there, it will over look the # 2 and still pull from that row since it has still has intermediate / curve in it.

    There is a little over 80 different combinations and variants of how the sequence can look, so was wanting it to look for the keyword in the sequence, instead of the exact match.

  10. #10
    Registered User
    Join Date
    06-04-2021
    Location
    USA
    MS-Off Ver
    2010
    Posts
    13

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    The key words i am wanting to use in the top row for each section are:

    Surface
    Intermediate
    Intermediate / Curve
    Intermediate / Curve/ Lateral
    Curve
    Curve / Lateral
    Lateral

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    Given the number of combinations it could be very complex

    These are found under LAT: LATERAL

    INT: INTERMEDIATE / CRV: CURVE / LAT: LATERAL
    INT2: INTERMEDIATE 2 / CRV: CURVE / LAT: LATERAL / SUR: SURFACE
    LAT: LATERAL
    LAT: LATERAL
    LAT: LATERAL / PILOT: PILOT
    LAT: LATERAL
    SUR: SURFACE / LAT: LATERAL

    BUT the bold are phases in their own right

    Can you remove SOLVED from this thread OR start a new one.

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    Please post an updated file with some example expected results

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    The SUMPRODUCT will work with the new "phases": however the matches need to be exact i.e extraneous blanks will cause a mismatch.

  14. #14
    Registered User
    Join Date
    06-04-2021
    Location
    USA
    MS-Off Ver
    2010
    Posts
    13

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    Very complex indeed. We are dependent upon the other people putting in the data properly, but obviously they do not all the time, but the data is still important and needed. Just makes it more tedious to go through. Either way, i have attached an updated sheet and Starting on row 20, displayed it how i wanted it to look. Beginning on A35:A41 i have the key words that are in row 20 color coded. C34:C113 I have most of the different types of sequence that it could look like. I colored which ones would be needed to match with the keyword in A35:A41. If the cell under C34 Remains uncolored, it would be to difficult and require a manual data analysis to determine the proper place and/or just forget it and it wont be taken into account and passed over.

    A35:41 - Color Coded Keywords
    C34:113 - Color Coded Sequences that match with Keywords in A35:A41
    A20:AH31 - How i am wanting it to look (More than likely will Copy and transpose to make it vertical to give it a better looking formatted visual like in J35:U68)
    Attached Files Attached Files

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Average Multiple Rows in Multiple Columns Based off Multiple Criteria Points

    See attached:

    I have organised the phase combinations into Named Ranges ("Phase1", Phase2" etc)

    In D23

    =IFERROR(SUMPRODUCT(('Motor KPI'!Q$2:Q$23)*('Motor KPI'!$A$2:$A$23=$A23)*('Motor KPI'!$B$2:$B$23=$B23)*(--ISNUMBER(MATCH('Motor KPI'!$CS$2:$CS$23,Phase1,0))))/SUMPRODUCT(('Motor KPI'!$A$2:$A$23=$A23)*('Motor KPI'!$B$2:$B$23=$B23)*(--ISNUMBER(MATCH('Motor KPI'!$CS$2:$CS$23,Phase1,0)))),"")

    Copy across to F

    Copy D F to next category (check ranges) and change Phase1 to Phase2 etc

    Check out results for Surface and Intermediate
    Attached Files Attached Files
    Last edited by JohnTopley; 06-07-2021 at 03:56 PM.

+ 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. [SOLVED] Lookup multiple criteria in multiple columns in multiple rows; return true if exists
    By ufdlim in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-07-2019, 02:03 PM
  2. [SOLVED] Average Based on Multiple Criteria in Same and Different Columns
    By KoolKatelyn in forum Excel Formulas & Functions
    Replies: 28
    Last Post: 02-20-2018, 02:15 PM
  3. Replies: 1
    Last Post: 02-09-2017, 05:55 PM
  4. Replies: 1
    Last Post: 02-15-2016, 04:35 PM
  5. Average numbers from multiple columns based on multiple criteria
    By abambi in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-23-2015, 01:52 PM
  6. [SOLVED] Average Based on Criteria in Multiple Columns
    By sinspawn56 in forum Excel General
    Replies: 2
    Last Post: 07-31-2012, 01:27 PM
  7. Replies: 1
    Last Post: 05-18-2009, 11:21 AM

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