View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Cell Colour depending on Value in Range

Will the cells always be contiguouis as you example shows:

Assuming looking for a macro:
if so, then you would just loop down accruing the sum until the target is
matched or exceeded.

It gets much more complex beyond that although Harlan Grove has an macro to
identify all combinations that sum to a specified amount.

Or are you looking for a conditional formatting formula? If so, how many
cells are we talking about? (although, except for exhaustive enumeration, I
don't know there is a good formula for this).

--
Regards,
Tom Ogilvy


"Trevor Williams" wrote:

Hi All

I need to be able to colour cells in a range that total a specified value,
plus, if possible add some notification to tell the user if the specified
value can't be matched exactly.

EXAMPLE:
If the specified value is 20, only cells A1:A3 would be coloured or
if the specified value is 40 cells A1:A4 would be coloured with a message
box to say that 40 couldn't be matched.

A
1 10
2 5
3 5
4 10
5 20

Any help would be appreciated.

Thanks

Trevor