ramdon sum

lx

New Member
Joined
Feb 7, 2005
Messages
4
hi! i have a list of amounts on column A, and i have a total on column B, i am trying to create a program that sum the values on column A until ithe sum is equal to the amount on column b, any clue, i am really without clue about this!!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Welcome:
You could add conditional formatting to highlight the last cell that is less than or equal to column B:

Click on cell A1
From the format menu, choose conditional formatting.
Choose "formula is" and type in the following:
=SUM($A$1:$A1)<=$B$1
Choose a format

This will highlight those cells that add up to less than the value in cell B1.

Is that the sort of thing you're after?
 
Upvote 0
no that dont help what i am trying to do is this:

----A------- ---------B-----------
5000 9000
3000
1000
2000
4000




result of macro or formula: sum of a1+A5 is equal to b1 / sum of a1+a2+a3 is equal to b1. i want the posibles sum with A numbers that are equal to b1
 
Upvote 0
There are a number of posts that deal with "combinations".

You could search for this and review them.

You shoud find some that allow you to list all of the combinations, which you can then add to see if they add to 9000.
 
Upvote 0
If I understand this right, you want to:

the first x values in column A that together sum the value in column B
(that is what your first post says)

or:

all combinations that together sum the value in column B.
Then my question is: where do you want to put this lists? This decides mainly if you want to use macro or not.
I never tried combinations but this should not be too hard if you understand a bit of VBA.
 
Upvote 0

Forum statistics

Threads
1,203,428
Messages
6,055,318
Members
444,780
Latest member
jtfish

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