How to sum a cell?

N

noyb

I have seen the use of "--" in a few responses here and in other groups
but fail to understand what the 2 '--'s do or why they are necessary. I
see that 1 - returns a negative, therefore 2 -'s return a positive, but
why does + or nothing, that is "(MID(....") return 0?
Can you explain?
Thanks
 
W

willie Loh

thks bro, it work.

noyb said:
I have seen the use of "--" in a few responses here and in other groups
but fail to understand what the 2 '--'s do or why they are necessary. I
see that 1 - returns a negative, therefore 2 -'s return a positive, but
why does + or nothing, that is "(MID(....") return 0?
Can you explain?
Thanks
 
V

vezerid

The -- is used when we want to convert textual values to their numeric
equivalent. In the above example, MID returns text. If it happens that
the text represents a number, it can be used in numeric calculations if
it is converted to a number. The same happens for values returning true
or false: even though in an explicit calculation true=1 and false=0, if
these values are found in an array and you want, e.g. SUM(A1:A10), and
some of these cells contain true, it will be ignored instead of
counting as 1. If you want to sum all these values, including T/F, you
could use:

=SUM(--A1:A10)

but then you would have to array-enter it (Shift+Ctrl+Enter).

HTH
Kostis Vezerides
 
Top