+ Reply to Thread
Results 1 to 3 of 3

Formula that returns a B when a sum of random numbers is zero with neg & pos #

  1. #1
    Forum Contributor
    Join Date
    10-05-2016
    Location
    orange, ca
    MS-Off Ver
    0365 2209
    Posts
    144

    Formula that returns a B when a sum of random numbers is zero with neg & pos #

    Hello all

    Hope you night is going well.

    In the provided sample, column A-M is a set of random numbers that can be positive, neg or zero and columns R through AF is the cumulative sum of these numbers starting from column A in the corresponding row.

    I am trying to make a formula in column AJ that returns B, otherwise blank ("") when when either 2 of the following condition is met (highlighted bold in the sample)

    1. The first cumulative sum or earliest sum in columns R-AF that is zero and the corresponding numbers that represent the cumulative sum are of opposite signs either negative numbers at the beginning with positives after without another negative once a positive number appears (prior to the first cumulative sum of zero) or vice versa.
    2. the first 2 numbers in column A & B are zero (like in row 22).

    As an example in row 6, the first 2 numbers are -1,0,-1,2..which the cumulative sum is zero and meeting condition 1.
    In row 7, the numbers are -1,0,-1,1,-2,1,2..the sum of these numbers are zero, but after the first positive number, 1, a -2 appears so it doesn't meet condition one.

    Thanks again for any help.
    Attached Files Attached Files
    Last edited by lar9149; 07-13-2021 at 10:19 AM.

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

    Re: Formula that returns a B when a sum of random numbers is zero with neg & pos #

    It would have been easier if you'd left the formulae in place!!

    =IFERROR(IF(OR(AND($A1=0,$B1=0),SIGN($A1)<>SIGN(INDEX($A1:$M1,MATCH(0,$R1:$AF1,0)))),"B",""),"")

    Your expected answer at row 7 seems to be incorrect.
    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 Contributor
    Join Date
    10-05-2016
    Location
    orange, ca
    MS-Off Ver
    0365 2209
    Posts
    144

    Re: Formula that returns a B when a sum of random numbers is zero with neg & pos #

    Quote Originally Posted by Glenn Kennedy View Post
    It would have been easier if you'd left the formulae in place!!

    =IFERROR(IF(OR(AND($A1=0,$B1=0),SIGN($A1)<>SIGN(INDEX($A1:$M1,MATCH(0,$R1:$AF1,0)))),"B",""),"")

    Your expected answer at row 7 seems to be incorrect.

    Thanks again Glenn Kennedy, I will make sure to include the formula next time.

+ 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. Filtering random numbers without regenerating random numbers
    By ptack in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-07-2022, 04:03 PM
  2. Formula that returns blank,0,1,-1 and compared to a row of numbers
    By lar9149 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-12-2021, 11:41 AM
  3. Replies: 2
    Last Post: 09-02-2015, 12:25 PM
  4. Random Numbers between 0-50 Each that Will Sum Up to A Value: Formula
    By NorthvsSouth in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-21-2015, 09:57 AM
  5. Replies: 1
    Last Post: 02-01-2013, 06:30 PM
  6. How to write a formula that returns a zero for negative numbers
    By thesongbirdsociety in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-01-2012, 02:33 PM
  7. Replies: 3
    Last Post: 07-06-2012, 02:03 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