Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-05-2011, 09:50 PM
PRADEEPB270's Avatar
PRADEEPB270 PRADEEPB270 is offline meaning and use of  -- in excel Windows Vista meaning and use of  -- in excel Office 2007
Novice
meaning and use of  -- in excel
 
Join Date: Aug 2011
Location: Gurgaon-INDIA
Posts: 17
PRADEEPB270 is on a distinguished road
Default meaning and use of -- in excel

what is the use and meaning of -- when used with excel formulla.
Reply With Quote
  #2  
Old 12-06-2011, 01:52 AM
macropod's Avatar
macropod macropod is offline meaning and use of  -- in excel Windows 7 64bit meaning and use of  -- in excel Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,367
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The double negation (--) is typically used to force digits that are expressed as text to be evaluated as numbers.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-06-2011, 04:09 AM
Colin Legg's Avatar
Colin Legg Colin Legg is offline meaning and use of  -- in excel Windows 7 32bit meaning and use of  -- in excel Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
meaning and use of  -- in excel VBA code from Excel 2007 in Excel 2010 csam63 Excel Programming 1 10-07-2011 10:46 AM
meaning and use of  -- in excel where we can find the meaning for all the marks that Word uses? Jamal NUMAN Word 2 06-26-2011 09:49 AM
meaning and use of  -- in excel Excel Hyperlinks crash Excel programme martinlest Excel 8 01-26-2011 04:23 AM
meaning and use of  -- in excel Opening multiple Excel files within the same Excel window. 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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft