+ Reply to Thread
Results 1 to 5 of 5

Turn Numbers Into Positive/Negative then Average

  1. #1
    Forum Contributor
    Join Date
    05-29-2017
    Location
    UK
    MS-Off Ver
    Pro Plus 2016
    Posts
    301

    Turn Numbers Into Positive/Negative then Average

    Hi guys, would you know how to crack this one up?

    I basically look to achieve the outcome:

    --- IF value in O3 = "y", then return number in N3 as positive
    --- IF value in O3 = "n", then return number in N3 as negative

    --- do the same for all found in the same column
    --- AVERAGE and return one total number


    The issue is that those "y", "n" in column O and numbers in column N are going 2,000 cells down with blank spaces and text in-between. So manual calculation as in attached file example... well, it's forever job and I don't know of any other way...

    Would you be okay taking a look and suggest a better formula, to be entered in D14, please? Thanking in advance!

    As per screenshot and file attached.


    https://www.excelforum.com/attachmen...1&d=1614612602

    https://www.excelforum.com/attachmen...1&d=1614612654
    Attached Images Attached Images
    Attached Files Attached Files

  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,023

    Re: Turn Numbers Into Positive/Negative then Average

    try this:
    =AVERAGE(IF(NOT(ISNUMBER($N$3:$N$24)),"",$N$3:$N$24*IF($O$3:$O$24="Y",1,-1)))

    You seem to be using an older version of Excel than me. So, please refer to the attached file. If the formulae are enclosed within a pair of { }, these are array formulae.

    These are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see the curly brackets { } appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Turn Numbers Into Positive/Negative then Average

    another alternative, based on your sample, would be to use SUMIF / COUNT:

    =SUM(SUMIF(O:O,{"y","n"},N:N)*{1,-1})/COUNT(N:N)
    confirmed with Enter

  4. #4
    Forum Contributor
    Join Date
    05-29-2017
    Location
    UK
    MS-Off Ver
    Pro Plus 2016
    Posts
    301

    Re: Turn Numbers Into Positive/Negative then Average

    Thank you so much Glenn! Greatly appreciate you looking into it.

    My file is already showing strong signs of getting slow... And because I will need to be sharing it with others, I need to avoid using anything that could then result in causing the issues for others. So no macros for sure and I'd very much want to avoid using arrays as well... is there no way without arrays? Like no way at all?...

    Sorry I didn't mention it earlier, I didn't think that we would run into the arrays here!

  5. #5
    Forum Contributor
    Join Date
    05-29-2017
    Location
    UK
    MS-Off Ver
    Pro Plus 2016
    Posts
    301

    Re: Turn Numbers Into Positive/Negative then Average

    Ah, that's the one, XLent, thanks a ton!! You guys are genius :-) 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] Formula For Average of Negative and Positive numbers
    By tradewithvlad in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-09-2021, 10:06 AM
  2. Turn positive numbers negative with Excel VBA
    By maxhecht2 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-27-2017, 03:39 PM
  3. Replies: 2
    Last Post: 09-11-2016, 02:28 AM
  4. [SOLVED] Finding average value for the positive and negative set of numbers
    By thilag in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-26-2014, 04:39 AM
  5. Average formula with positive and negative numbers
    By lovebeingtan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-29-2012, 08:28 PM
  6. How to turn positive numbers in a column to negative numbers ?
    By Dbase Beginner in forum Excel General
    Replies: 1
    Last Post: 03-30-2005, 03:14 AM
  7. Replies: 4
    Last Post: 01-08-2005, 02:06 PM

Tags for this Thread

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