+ Reply to Thread
Results 1 to 3 of 3

Consecutive & Multiplicative =IF statement

  1. #1
    Registered User
    Join Date
    12-28-2018
    Location
    Denver
    MS-Off Ver
    2016
    Posts
    2

    Consecutive & Multiplicative =IF statement

    Been a long going excel user, which means I rarely come across something I can't immediately figure out. That being said, I can't think of an easy way to solve this =IF statement; hopefully this is super easy and I'm just being silly :p

    I'm trying to determine the % gain and % loss from a string of consecutive negatives or positives, and more specifically the largest string for both negatives and positives. For example, if I have a list: 22%, 12%, 13%, (-)18%, 2%, 4%, (-)2%, (-)5%, (-)10%, 12%, 1%, etc. etc., I want to find the strings of positives (22,12,13 and 2,4) and multiply them one by one to determine a %gain to initial after those three and two transactions; the same goes for the negative strings (-2,-5,-10). Because 22,12,13 is a string of three versus 2,4 a string of two, I want to only find the gain for the string 22,12,13.

    Here's what I've got for counting the longest string so far:

    =ArrayFormula(MAX(FREQUENCY(IF(B10:B98<0%,ROW(B10:B98)),IF(B10:B98>=0%,ROW(B10:B98))))) [changing the inequalities for + and - values]

    Because I can't just sum the string (sum of % isn't compounded gain or loss), I can't think of an easy way to find the longest string (which may or may not be the largest or smallest value).

    Any input is greatly appreciated

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,709

    Re: Consecutive & Multiplicative =IF statement

    Welcome to the forum!

    Please attach a sample workbook.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired results are also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    12-28-2018
    Location
    Denver
    MS-Off Ver
    2016
    Posts
    2

    Re: Consecutive & Multiplicative =IF statement

    First of all, thank you! Second of all, my initial post is horrendous on second glance. Was flustered after a few hours of coding. Yikes!

    Attached to this <----- post is an example doc. I'm *pretty* sure I've figured it out, as I managed to make an awfully convoluted =IF statement that was able to be copied down the row.

    However, if there are any easier methods for the future, or if I'm still on the wrong track, I would love to hear them!

    Key IF lines:
    =IF($A5<0%,IF($A6<0%,((1+$A5)*$A2)*(1+$A6),$A2),IF($A6>0%,((1+$A5)*$A2)*(1+$A6),$A2))
    =IF($C5<>$A$2,IF($A6<0%,IF($A7<0%,((1+$A7)*$C5),$A$2),IF($A7>0%,((1+$A7)*$C5),$A$2)),IF($A6<0%,IF($A7<0%,((1+$A6)*$A$2)*(1+$A7),$A$2),IF($A7>0%,((1+$A6)*$A$2)*(1+$A7),$A$2)))

    [If previous line does not equal original then =chain, check previous line for the same inequality as current, compound. If not, return to original value A2. If previous line is A2, then new chain begins. Check next line for same inequality as current. Compound, otherwise return A2]
    repeat**^^
    Attached Files Attached Files
    Last edited by Bellefeu; 12-28-2018 at 05:19 AM.

+ 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] IF statement for non-consecutive numbers
    By Sinnie in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-12-2016, 02:53 PM
  2. [SOLVED] non consecutive to consecutive to cells
    By zara_toustra in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2014, 02:11 PM
  3. How to run a multiplicative regression in Excel 2013?
    By excel-noob in forum Excel General
    Replies: 6
    Last Post: 03-12-2014, 06:43 PM
  4. Replies: 1
    Last Post: 05-29-2013, 10:35 AM
  5. Replies: 6
    Last Post: 04-28-2012, 08:50 AM
  6. Replies: 6
    Last Post: 03-23-2012, 06:03 PM
  7. Excel macro to "fill in" consecutive numbers in non-consecutive list?
    By Tomkat in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2009, 01:13 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