View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default subtracting the highlighted ones

We need some more info here, like where's the total at? I assume that the
sdkjfs entries are the ones you're going to highlight since it seems rather
difficult to subtract numbers from letters.

There is NO worksheet function to detect whether or not a cell is
highlighted, shaded, bordered, or has specially colored text. To do what you
want would require a macro. Now, what you could consider doing is adding in
a couple of helper columns:

Assuming that the numbers are in column A, those letters in column B, you
could set something up like this: In column C, next to the sdkjfs entries
and tell you users to put an X in them for values not to include in the
total. In column D put a formula like this (again, assumes 1256 sdkjfs is on
row 1)
=IF(C1<"",0,A1)
This is actually a cheat, user could enter anything, an X or a or any
character to exclude the value from the total. Fill the formula down the
sheet. Hide column D. Where you have your total being calculated now and
may have a formula something like
=SUM(A1:A7)
change it to
=SUM(D1:D7)
now it totals the non-excluded numbers, without a single line of code.

"ganga" wrote:

i just want to how can we subtract the highlighted ones from the total.

eg:
1256 sdkjfs
1236 dfsdf
2569 dfsdfs
2669 dfsdfs
3214 dfsdf
2200 sdfsdf
1230 dfsdfsdf

when i highlight the 2nd column each time i want the 1st column to be
subtracted from the total(all the highlighted ones).

thank you