+ Reply to Thread
Results 1 to 12 of 12

Average together two columns, including only numbers between two values

  1. #1
    Registered User
    Join Date
    02-02-2021
    Location
    Virginia
    MS-Off Ver
    365
    Posts
    13

    Average together two columns, including only numbers between two values

    Hello all,

    I am trying to get an average of two non-consecutive columns, and only include values between 80 and 120. In the screenshot below, I would like to average the values in columns I and K. I also need to exclude any "" cells and cells that may contain #N/A
    Thanks!

    Screenshot 2021-02-05 155746.png
    Last edited by labratto; 02-05-2021 at 05:48 PM.

  2. #2
    Registered User
    Join Date
    02-02-2021
    Location
    Virginia
    MS-Off Ver
    365
    Posts
    13

    Re: Average together two columns, including only numbers between two values

    I attached a sample of the data below.
    Attached Files Attached Files

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Average together two columns, including only numbers between two values

    Are you looking to average each row individually (i.e. Average(I5,K5) or average all values?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    02-02-2021
    Location
    Virginia
    MS-Off Ver
    365
    Posts
    13

    Re: Average together two columns, including only numbers between two values

    Average all the values together.

  5. #5
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,830

    Re: Average together two columns, including only numbers between two values

    Does this give you what you want? (the average based on your conditions is 102.375

    =AVERAGE(FILTERXML("<x><m>"&TEXTJOIN("</m><m>",,FILTER($I$5:$I$26,($I$5:$I$26>=80)*($I$5:$I$26<=120)),FILTER($K$5:$K$26,($K$5:$K$26>=80)*($K$5:$K$26<=120)))&"</m></x>","//m"))

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Average together two columns, including only numbers between two values

    Try to combine two AVERAGE's of two ranges

    Please Login or Register  to view this content.
    Quang PT

  7. #7
    Registered User
    Join Date
    02-02-2021
    Location
    Virginia
    MS-Off Ver
    365
    Posts
    13

    Re: Average together two columns, including only numbers between two values

    Quote Originally Posted by Gregb11 View Post
    Does this give you what you want? (the average based on your conditions is 102.375

    =AVERAGE(FILTERXML("<x><m>"&TEXTJOIN("</m><m>",,FILTER($I$5:$I$26,($I$5:$I$26>=80)*($I$5:$I$26<=120)),FILTER($K$5:$K$26,($K$5:$K$26>=80)*($K$5:$K$26<=120)))&"</m></x>","//m"))
    This seems to work for my sample data set but when I try to change the ranges for more data, it returns an error. For example, I applied this to another sheet and it returns #value!

    =AVERAGE(FILTERXML("<x><m>"&TEXTJOIN("</m><m>",,FILTER($I$11:$I$7388,($I$11:$I$7388>=80)*($I$11:$I$7388<=120)),FILTER($F$11:$F$7388,($F$11:$F$7388>=80)*($F$11:$F$7388<=120)))&"</m></x>","//m"))

    What am I missing?
    Last edited by labratto; 02-09-2021 at 01:26 PM. Reason: make it clear who this reply is to

  8. #8
    Registered User
    Join Date
    02-02-2021
    Location
    Virginia
    MS-Off Ver
    365
    Posts
    13

    Re: Average together two columns, including only numbers between two values

    Quote Originally Posted by bebo021999 View Post
    Try to combine two AVERAGE's of two ranges

    Please Login or Register  to view this content.
    Its close but not the the exact value.
    Last edited by labratto; 02-09-2021 at 01:25 PM. Reason: make it clear who this reply is to

  9. #9
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,830

    Re: Average together two columns, including only numbers between two values

    I applied this to another sheet and it returns #value!
    Its close but not the the exact value.
    Which is it, close but not exact, or returns #value!

    It may be because it's several thousand rows - I'm not sure that formula works for large amounts.
    Can you post the spreadsheet?

  10. #10
    Registered User
    Join Date
    02-02-2021
    Location
    Virginia
    MS-Off Ver
    365
    Posts
    13

    Re: Average together two columns, including only numbers between two values

    bebo021999's suggestion of averaging two averages is close but not the correct answer.
    Your suggestion works for the small data set but not the larger one.

    Here is another data set.
    Attached Files Attached Files
    Last edited by labratto; 02-09-2021 at 03:38 PM.

  11. #11
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,830

    Re: Average together two columns, including only numbers between two values

    How about this?

    =(SUMIFS(F11:F3877,F11:F3877,">=80",F11:F3877,"<=120") + SUMIFS(I11:I3877,I11:I3877,">=80",I11:I3877,"<=120")) / (COUNTIFS(F11:F3877,">=80",F11:F3877,"<=120") + COUNTIFS(I11:I3877,">=80",I11:I3877,"<=120"))

  12. #12
    Registered User
    Join Date
    02-02-2021
    Location
    Virginia
    MS-Off Ver
    365
    Posts
    13

    Re: Average together two columns, including only numbers between two values

    Quote Originally Posted by Gregb11 View Post
    How about this?

    =(SUMIFS(F11:F3877,F11:F3877,">=80",F11:F3877,"<=120") + SUMIFS(I11:I3877,I11:I3877,">=80",I11:I3877,"<=120")) / (COUNTIFS(F11:F3877,">=80",F11:F3877,"<=120") + COUNTIFS(I11:I3877,">=80",I11:I3877,"<=120"))
    This works, thank you!

+ 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] Average if values in adjacent columns is >0 AND adjust the average range each time
    By ew17 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-17-2020, 12:56 PM
  2. Replies: 10
    Last Post: 04-05-2019, 02:32 PM
  3. Average Values when including a ceiling max of a cell's value
    By Miskondukt in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-22-2016, 03:53 AM
  4. Replies: 2
    Last Post: 07-02-2013, 10:02 AM
  5. Replies: 2
    Last Post: 06-19-2013, 04:58 PM
  6. Replies: 6
    Last Post: 01-07-2013, 08:58 PM
  7. Replies: 3
    Last Post: 04-09-2012, 02:53 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