![Excel sums to zero Excel sums to zero](http://www.voyagercapitalmgt.com/wp-content/uploads/2015/02/impact-costs-investor-returns.jpg)
![Zero Zero](/uploads/1/2/3/7/123773680/445724260.jpg)
SUM feature not working Windows 2010 Excel have just installed windows 2010 and the SUM feature in excel is returning an answer of zero. I have tried typing in =SUM(cell A:cell B) and even labouriously typing +cell 1+ cell 2 etc for every cell in the range, but the answer remains zero.
Say I have a simple function in MySQL:
If no entries in Column 2 contain the text 'Test' then this function returns NULL, while I would like it to return 0.
I'm aware that a similar question has been asked a few times here, but I haven't been able to adapt the answers to my purposes, so I'd be grateful for some help to get this sorted.
NickNick
3 Answers
Use
COALESCE
to avoid that outcome.To see it in action, please see this sql fiddle: http://www.sqlfiddle.com/#!2/d1542/3/0
More Information:
Given three tables (one with all numbers, one with all nulls, and one with a mixture):
MySQL 5.5.32 Schema Setup:
Query 1:
Results:
Brad ChristieBrad Christie
Use
IFNULL
or COALESCE
:The difference between them is that
IFNULL
is a MySQL extension that takes two arguments, and COALESCE
is a standard SQL function that can take one or more arguments. When you only have two arguments using IFNULL
is slightly faster, though here the difference is insignificant since it is only called once.Mark ByersMark Byers
Can't get exactly what you are asking but if you are using an aggregate SUM function which implies that you are grouping the table.
The query goes for MYSQL like this
Flexo♦
Sashi KantSashi Kant