+ Reply to Thread
Results 1 to 12 of 12

Find the biggest 'downturn' in a column of positive and negative numbers

  1. #1
    Registered User
    Join Date
    11-22-2017
    Location
    Downunder
    MS-Off Ver
    Excel 2016
    Posts
    7

    Find the biggest 'downturn' in a column of positive and negative numbers

    Hello,

    I have a long column of various numbers, positive and negative.
    Is it possible to find out the value of the biggest overall loss in the column (i.e. the biggest downturn)?

    5
    4
    -3
    -5
    2
    -3
    11
    0
    -8
    50
    -8
    50

    In the above example I would like a return value of 9 (the biggest downturn as seen in A3 to A6).
    The column will always have an overall positive sum. I don't mind having an extra column of data if it makes things easier.
    Hope that makes sense. I've attached an example sheet.

    Any help would be much appreciated! Thanks.
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,897

    Re: Find the biggest 'downturn' in a column of positive and negative numbers

    How do you define "downturn"? What do these numbers mean?

    In the file you attached you said the biggest loss was in A9:A13 for a net of -427 but if you sum A3:A13 you get -541, much larger loss. A19:A24 is -554. So it's not clear at all what you are trying to do.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-22-2017
    Location
    Downunder
    MS-Off Ver
    Excel 2016
    Posts
    7

    Re: Find the biggest 'downturn' in a column of positive and negative numbers

    Sorry, you're right, I didn't give a proper set of numbers. How about this:

    5
    4
    -3
    -5
    2
    -3
    112
    0
    -8
    5000
    -8
    5000

    I would like the largest overall loss, regardless of how many rows it covers. The overall sum of the column will always be positive.
    The numbers are variables.
    Last edited by Armstrong69; 11-26-2017 at 05:39 PM.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,897

    Re: Find the biggest 'downturn' in a column of positive and negative numbers

    All the latest post does is provide a different list of numbers. I am looking for a definition (not only an example) of the result you are looking for. Like:

    Find the subset of consecutive numbers in the list that sum to the highest-magnitude negative number.

    But that's just an example...I'm still not sure what you mean.

    P.S. If that is what you mean then I'm pretty sure it needs a macro. Not difficult, but I would like to solve this in one try.

  5. #5
    Forum Contributor shivya's Avatar
    Join Date
    08-19-2017
    Location
    Delhi, India
    MS-Off Ver
    2013
    Posts
    240

    Re: Find the biggest 'downturn' in a column of positive and negative numbers

    Hello Armstrong,
    I don't understand, what you want exactly but i think it should be like

    =SUM(LARGE(A1:A12,{1;2;3}),SMALL(A1:A12,{1;2;3})) -> ctrl + shift + enter
    To attach worksheet Go advanced -> Manage attachments -> Choose file -> Upload
    Don't forget to Mention your desired result in the sheet..
    There should be sample data only, a lot of data creates confusion.

    Thanks & Regards

    Shivya

    http://excelvbatipsforbeginners.blogspot.in/

  6. #6
    Registered User
    Join Date
    11-22-2017
    Location
    Downunder
    MS-Off Ver
    Excel 2016
    Posts
    7

    Re: Find the biggest 'downturn' in a column of positive and negative numbers

    Imagine there is a running total. I want to find the largest loss that happens before the running total reaches a new maximum.
    Does this pic help? In this example I would want the answer 20.
    Attached Images Attached Images

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,703

    Re: Find the biggest 'downturn' in a column of positive and negative numbers

    How have you calculated 20? That run includes a positive number - how do you define a loss?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  8. #8
    Registered User
    Join Date
    11-22-2017
    Location
    Downunder
    MS-Off Ver
    Excel 2016
    Posts
    7

    Re: Find the biggest 'downturn' in a column of positive and negative numbers

    Yes, it includes a positive number. 20 is the difference between the 'peak' of the running total (in the red circle) and the lowest point (also in the red circle) before the running total reaches a new maximum.

  9. #9
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Find the biggest 'downturn' in a column of positive and negative numbers

    Hi
    I do not Know if this can help you.

    I use your first file and move your data three rows down

    B2, B3 and C3 are zeros (initialize formulas) and run totals in B4

    Use in C4 the following formula (copy down)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The value (I suppose) is the minimum value of that column.

    See the file
    Attached Files Attached Files

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,897

    Re: Find the biggest 'downturn' in a column of positive and negative numbers

    From your example I take it you mean a new global maximum rather than a local maximum (e.g., 40 on row 11 is a local maximum). I still think your definition is not rigorous from a mathematical standpoint but I am trying to grok what you are looking for. You still have not responded to my two requests for the background of what these numbers mean, but here is an attempt using a macro. This uses your most recent data posted as an image, because that seems to the be the best explanation of what you want.

    The problem is to:

    1. Examine each occurrence of a new maximum. A new maximum is defined as a point that is a global maximum compared to the points to its left.
    2. Determine the loss preceding each new maximum. A loss is defined as the drop starting from the previous maximum to the previous local minimum. The previous local minimum is the point of the lowest value after the previous maximum and before reaching the new maximum.
    3. Determine which of these losses has the largest magnitude.

    In the future, consider that an image attachment has very little value. Just attach the Excel file. It's easier than taking a screenshot first and then attaching that. Under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-22-2017
    Location
    Downunder
    MS-Off Ver
    Excel 2016
    Posts
    7

    Re: Find the biggest 'downturn' in a column of positive and negative numbers

    I'm sorry I've done such a poor job of explaining what I'm after
    I've solved it myself and attached an example sheet.

    6StringJazzer: The numbers represent profit/loss projections that change according to a formula that I'm constantly reassessing.

    Thanks all for your help, you forum mods certainly have a lot of patience
    Attached Files Attached Files

  12. #12
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,897

    Re: Find the biggest 'downturn' in a column of positive and negative numbers

    That's pretty good thinking. That's what I thought you were trying to do (now I see a bug in my solution) and you very elegantly solved it with formulas, which I didn't think possible. Bravo.

+ 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] splitting positive and negative numbers from 2 column to 2 columns
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2016, 06:31 AM
  2. [SOLVED] Find consecutive 15 positive or negative numbers in a column
    By Sarangsood in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-19-2013, 05:26 AM
  3. Convert negative to positive in sheet containing both positive/negative numbers
    By sa02000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2010, 07:52 PM
  4. Replies: 3
    Last Post: 12-17-2009, 09:14 AM
  5. Replies: 2
    Last Post: 09-28-2005, 12:05 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: 3
    Last Post: 03-24-2005, 03:06 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