Amend a list of numbers until their sum is less than a specified number

ormy28

New Member
Joined
Dec 10, 2007
Messages
20
Office Version
  1. 365
Hi All

I would really appreciate some help with a task I have to complete in Excel.

I have a list of numbers in column A:

4
19
6

Next to them in column B, this list of numbers needs to be replicated, although the sum of the three numbers cannot exceed 20. The first number in the list (in this case 4), needs to be reduced by 1 until the sum of the three numbers reaches 20. After this, if 20 is not reached, then the first number should be zero and the 2nd number (19 in this case), also needs to be reduced until the sum of the three numbers reached 20. And if this target still isn't reached, the first two numbers will be zero, and the third number set to 20. Hope that makes sense!

Therefore, using the example above, the list of numbers in column B should be:

0
14
6

The original list of numbers in column A are generated using a variety of formulas from other tabs, therefore the combination will almost always be different.

I am completely stumped as to how to achieve this using Excel formula alone, and would rather avoid VBA. However, I sense that might be the only way.

Thanks
Mark.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Like this?
Book2
ABCD
1Target20
240
31914
466
5
Sheet7
Cell Formulas
RangeFormula
B2:B4B2=MEDIAN(A2,0,$D$1-SUM(A3:A$5))
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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