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
Bookmarks