+ Reply to Thread
Results 1 to 11 of 11

average ifs within a targeted range

  1. #1
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    120

    average ifs within a targeted range

    Hi,
    i want to do an average of the year-over-year change, in all these four columns: revenue, OI, ebitda, EPS that is Y/Y . But i only want to include in average if the answer falls in the range that is above -75% or below -75%. So if you look at the example , those in yellow would be excluded.

    I tried to write a formula but it didn't work - i was trying to say like if you do the % change for the average only do it or when the answer is above -75% or below 75%.


    =AVERAGEIFS((D3:D6/I3:I6)-1, N3:I6, ">="&-0.75, I36:I6, "<="&0.75)
    ADDED ANOTHER FILE - MORE EXAMPLE
    Attached Files Attached Files
    Last edited by dianaCatz; 04-24-2024 at 07:21 PM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: average ifs within a targeted range

    As there were no expected answers, this is a guess:

    =BYCOL(L3:O6,LAMBDA(z,AVERAGE(FILTER(z,ABS(z)<0.75))))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    120

    Re: average ifs within a targeted range

    THANK YOU! It worked well in that area. However, when i tried to replicate the formula in another area - in the W column, X and Y column it did not work. is it the iferrors in the formula? i tried to delete all the cells that iferrors bought back no value but that didn't solve the issue. I added another examples file now to the main post called more example.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: average ifs within a targeted range

    1. Restore the original formulae in all of the data cells in columns W:Y.

    2. Use:

    =BYCOL(W4:Y52,LAMBDA(z,AVERAGE(FILTER(z,ABS(N(z))<0.75))))
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    120

    Re: average ifs within a targeted range

    Thanks that worked. Can you help me understand, what is BYCOL?

    Lambda allows you to create customer functions like a filter?

    Thank you so much

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: average ifs within a targeted range

    Away from PC... in bright sunshine on my phone so excuse any bad spelling errors!!

    BYCOL is one of a number of functions which support LAMBDA.

    It is used when a 2D array is being calculated to return a one dimensional horizontal array... a row, in effect.

    The calculation is performed column-by- column, each coulumn returning a SINGLE value.

    BYROW, in contrast wouldvprocess the array row-by row and produce a singble column vertical array (ie a column).

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: average ifs within a targeted range

    You're welcome. Thanks for letting us know that you got an answer.




    Please take a moment and consider clicking the "Add Reputation" button at the foot of any of the posts of anyone who helped you reach a solution here today.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  8. #8
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    120

    Re: average ifs within a targeted range

    - Thank you so very much!
    - May I ask two more questions?
    - Does this formula exclude those under -75% and those over +75%? Or is it just excluding those over 75%?
    - Again when I tried to take this formula to another spreadsheet I got a SPILL error. See U57 in "another example added to the top".
    Last edited by dianaCatz; 04-24-2024 at 01:31 PM.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: average ifs within a targeted range

    1. Yes. Both are excluded. That's what the ABS is doing.

    2. SPILL errors are caused when other stuff is in cells that the formula needs to place results. In the case of your latest sheet... MOVE the formula to an empty area, or delete your formulae that are in the way.

  10. #10
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    120

    Re: average ifs within a targeted range

    thank you so very much

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: average ifs within a targeted range

    Woo Hoo!

    You're welcome...

+ 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] Targeted Index/Match?
    By gsaxton91 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-24-2020, 12:10 AM
  2. [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
  3. [SOLVED] Find Replace items in list to targeted range Range=A:A, What=Col_x Replacement=Col_y
    By _MANNY_ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-04-2020, 05:24 AM
  4. [SOLVED] Taking the average of multiple groups of cells with ability to extend range of average
    By 2597Gar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2019, 11:07 AM
  5. [SOLVED] Macro runs while in focus of targeted workbook but out-of-range once I change of wb
    By Exequiel3k in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2019, 01:38 PM
  6. Automatic value from targeted Tab and cell
    By toplisek in forum Excel General
    Replies: 8
    Last Post: 10-29-2014, 05:27 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