+ Reply to Thread
Results 1 to 7 of 7

Function until conditions met

  1. #1
    Registered User
    Join Date
    10-14-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    5

    Smile Function until conditions met

    This problem is driving me nuts so any help will be truly appreciated.

    I have 3 rows and 31 columns.

    The first row from A1 onwards contains the carry-over amount, (I'll call this amount COA). The COA must be carried over to each next column that if the test conditions are met. This is a successive formula so that if the conditions are met on several columns, the sum of the COA's gets carried to the right to the column with the cell testing the columns to its left.

    The second row from A2 onwards is produced by means of a COUNTIF formula, which determines the number of entries in each of the 31 columns.

    The third row starting from A3 onwards is for the results of the above. This is the row that I need the formulas for. I'll use the table below to help illustrate what I need.

    A | .B. | C. | D. | E. | F | G. | H. | I
    5. | 10 | 20 | 30 | 10 | 5 | 10 | 10 | 5 [Row 1: Carry over amounts.]
    3. | 10 | 2.. | 4. | 6.. | 7. | 3. | 3.. | 5 [Row 2: COUNTIF values. These may vary.]
    0. | 15 | 0.. | 50 | 60 | 65 | 0. | 0. | 25 [Row 3: I need the formula(s) for this row.]

    (Sorry about the '.'s. I didn't know how else to line the columns up. ; See the attachment for the actual workbook.))

    Explanation:

    1. A3 will default to 0.
    2. Since B2>A2 add A1 and B1.
    3. Since C2<B2 result must = 0.
    4. Since D2>C2, but less than B2 add C1 and D1.
    5. Since E2>D2>C2, but less than B2 add C1, D1 and E1.
    6. Since F2>E2>D2>C2, but less than B2 add C1:F1.
    7. Since G2<F2 the result = 0.
    8. Since H2=G2 the result =0.
    9. Since I2>H2 and >G2 add G1:I1

    The amount to carry over takes place when the COUNTIF number in the column to the left is less than COUNTIF number in the calculating column. For example, since A2 is less than B2, A1 is added to B1. This needs to be successive until a column with a higher COUNTIF number to the left is found, in which case the carry over amounts of the in between columns are summed and added to the present column. For example F2 has a higher COUNTIF value than all the columns to the left up to B2, which has a higher COUNTIF value than F2. Therefore, the COA values of C1:F1 are added.

    I hope my explanation has been clear and detailed enough. I need the formula(s) that will work throughout row 3. I have struggled with this for over a month now and am not getting anywhere.

    Appreciate the help.

    GBExcel
    Attached Files Attached Files
    Last edited by GBExcel; 10-14-2009 at 02:07 PM. Reason: To add an attachment

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Function until conditions met

    Welcome to the forum.

    An explanation with a workbook would be a lot easier to follow.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-14-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Function until conditions met

    Thank you.

    I added an attachment to the above post as per your suggestion.

    GBExcel
    Last edited by GBExcel; 10-14-2009 at 02:09 PM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Function until conditions met

    In C3 and copy across, =IF(C2<=B2, 0, SUM(INDEX(1:1, MATCH(2, 1/($A2:B2>=C2) ) + 1):C1 ) )

    The formula must be committed with Ctrl+Shift+Enter.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697

    Re: Function until conditions met

    Also cross-posted here

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Function until conditions met

    GBExcel, suggest you read our forum rules closely before posting again.

  7. #7
    Registered User
    Join Date
    10-14-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Function until conditions met

    Thank you. You are quite right. I apologize for the oversight.

    Regards,

    GBExcel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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