![]() |
|
#1
|
||||
|
||||
![]()
It's also very commonly used in SUMPRODUCT().
SUMPRODUCT() can only process numbers; you'll often find that you have a situation where you have an array of booleans which need to be coerced into numbers so that SUMPRODUCT() can use them. This can be done by performing a simple arithmetic operation on them. For example: TRUE+0 coerces TRUE to 1 TRUE-0 coerces TRUE to 1 TRUE*1 coerces TRUE to 1 TRUE/1 coerces TRUE to 1 (and many more). You'll be familiar with addition, subtraction, multiplication and division as shown above. There's also negation which is achieved by applying the unary minus operator: -TRUE coerces TRUE to -1 --1 gives 1 so --TRUE coerces TRUE to 1 When people choose how to do the coercion they could use any of these options, but many people decide to use two unary minus operators. This is for 2 reasons: (1) Unary minus sits high up on the operator precedent list (2) Double negation is marginally faster to calculate than the other options Some further reading for you: SUMPRODUCT Array Formulas (see particularly post #5) Hope that helps... Colin |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
csam63 | Excel Programming | 1 | 10-07-2011 10:46 AM |
![]() |
Jamal NUMAN | Word | 2 | 06-26-2011 09:49 AM |
![]() |
martinlest | Excel | 8 | 01-26-2011 04:23 AM |
![]() |
lost9471 | Excel | 2 | 05-01-2010 01:57 PM |
How do I use an Excel form to populate and Excel spreadsheet | apostht | Excel | 0 | 05-21-2006 11:17 AM |