Hi, I'm stuck with something in Excel 2019 and am after a solution for the following please:
I have 2 columns of data, A and B.
Columns A and B are populated by other formulae results.
Column E describes the cells in column F in this example.
Cell F1 is manually populated.
Cell F2 is populated by a formula.
The amount of rows in columns A and B will change as new data is entered.
I need the formula to solve with the following rules:
Exactly one cell from column A must be used.
The cell adjacent to that used in column A must be used, eg if cell A4 used, cell B4 must be used.
The total number of cells from column B to be used is set in cell F1.
Further figure to be used in the formula is in cell F2.
Desired result = I get the lowest outcome when all the rules are obeyed (negative result acceptable so would need the most negative number in this case).
F2 + (selected cell in column A) - (sum of all cells used from column B).
Below was as far as I got but this does not force the adjacent cell to that used in column A to be used. So in the example it uses A2 (lowest value in A) and then uses B4 and B6. However, in this example I'd need it to use A4 so automatically use B4 and then B6 also.
=F2 - SUMIF(B4:B1000, ">="&LARGE(B4:B1000,F1)) + MIN(A4:A1000)
I hope this is clear, please ask if any questions and thanks in advance for any help.
Chris
I have 2 columns of data, A and B.
Columns A and B are populated by other formulae results.
Column E describes the cells in column F in this example.
Cell F1 is manually populated.
Cell F2 is populated by a formula.
The amount of rows in columns A and B will change as new data is entered.
I need the formula to solve with the following rules:
Exactly one cell from column A must be used.
The cell adjacent to that used in column A must be used, eg if cell A4 used, cell B4 must be used.
The total number of cells from column B to be used is set in cell F1.
Further figure to be used in the formula is in cell F2.
Desired result = I get the lowest outcome when all the rules are obeyed (negative result acceptable so would need the most negative number in this case).
F2 + (selected cell in column A) - (sum of all cells used from column B).
Below was as far as I got but this does not force the adjacent cell to that used in column A to be used. So in the example it uses A2 (lowest value in A) and then uses B4 and B6. However, in this example I'd need it to use A4 so automatically use B4 and then B6 also.
=F2 - SUMIF(B4:B1000, ">="&LARGE(B4:B1000,F1)) + MIN(A4:A1000)
I hope this is clear, please ask if any questions and thanks in advance for any help.
Chris