Returning min value on sum of cells with varying rules

chr1sj

New Member
Joined
Jul 15, 2021
Messages
22
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
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
 

Attachments

  • excel example.PNG
    excel example.PNG
    12.5 KB · Views: 20
Thanks for the XL2BB sample.

See if this works for you

Excel Formula:
=LET(n_1,INDEX(A4:A100,MATCH(MIN(I4:I100),I4:I100,0)),srt,SORTBY(A4:A100,D4:D100,-1),sels,FILTER(srt,srt<>""),TEXTJOIN(", ",1,n_1,INDEX(FILTER(sels,sels<>n_1),SEQUENCE(R4-1))))
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
That is working perfectly Peter. I'm sorry for wasting your time - I hadn't looked at the add-on and had not clue the presence of a formula would make a difference - v amateur!

Kind regards,

Chris
 
Upvote 0

Forum statistics

Threads
1,214,981
Messages
6,122,565
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top