Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
If Statement help, please
Hi all
I have what seemed to me to be a simple task: If both A1 and B1 have nothing in them, show nothing, but if either cell has something in it, do the math...A1+B1. So I wrote: if(A1+B1="","",A1+B1). Unfortunately, it'll do the math, but it shows a zero for the rows that have no input. Can someone help?? And explain why?? Thanks very much -- smither fan |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
If Statement help, please
I'd use:
=if(count(a1,b1)=2,a1+b1,"") Ross wrote: Hi all I have what seemed to me to be a simple task: If both A1 and B1 have nothing in them, show nothing, but if either cell has something in it, do the math...A1+B1. So I wrote: if(A1+B1="","",A1+B1). Unfortunately, it'll do the math, but it shows a zero for the rows that have no input. Can someone help?? And explain why?? Thanks very much -- smither fan -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
If Statement help, please
Thanks Dave. Can you please tell me why my original one didn't work?
-- smither fan "Dave Peterson" wrote: I'd use: =if(count(a1,b1)=2,a1+b1,"") Ross wrote: Hi all I have what seemed to me to be a simple task: If both A1 and B1 have nothing in them, show nothing, but if either cell has something in it, do the math...A1+B1. So I wrote: if(A1+B1="","",A1+B1). Unfortunately, it'll do the math, but it shows a zero for the rows that have no input. Can someone help?? And explain why?? Thanks very much -- smither fan -- Dave Peterson |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
If Statement help, please
Well, you'd already demonstrated that A1+B1 was doing the arithmetic and
being calculated as zero, so when you compared it with the empty string "" it failed the test. [You can check the result of the comparison and see that =(0="") returns FALSE.] If you wanted to use the string comparison, you could have used as the input the result of a string concatenation instead of an arithmetic addition, and hence you could have used =IF(A1&B1="","",A1+B1) That, however, still wouldn't have worked if one or both of your input cells had not been empty but, for example, contained a space " ", so the COUNT recommendation is a better bet. -- David Biddulph "Ross" wrote in message ... Thanks Dave. Can you please tell me why my original one didn't work? "Dave Peterson" wrote: I'd use: =if(count(a1,b1)=2,a1+b1,"") Ross wrote: Hi all I have what seemed to me to be a simple task: If both A1 and B1 have nothing in them, show nothing, but if either cell has something in it, do the math...A1+B1. So I wrote: if(A1+B1="","",A1+B1). Unfortunately, it'll do the math, but it shows a zero for the rows that have no input. Can someone help?? And explain why?? |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
If Statement help, please
Well, you're right. It certainly did do the trick. And thanks for
explaining it. There's no way I would get as good an explaination from the Help menu! -- smither fan "David Biddulph" wrote: Well, you'd already demonstrated that A1+B1 was doing the arithmetic and being calculated as zero, so when you compared it with the empty string "" it failed the test. [You can check the result of the comparison and see that =(0="") returns FALSE.] If you wanted to use the string comparison, you could have used as the input the result of a string concatenation instead of an arithmetic addition, and hence you could have used =IF(A1&B1="","",A1+B1) That, however, still wouldn't have worked if one or both of your input cells had not been empty but, for example, contained a space " ", so the COUNT recommendation is a better bet. -- David Biddulph "Ross" wrote in message ... Thanks Dave. Can you please tell me why my original one didn't work? "Dave Peterson" wrote: I'd use: =if(count(a1,b1)=2,a1+b1,"") Ross wrote: Hi all I have what seemed to me to be a simple task: If both A1 and B1 have nothing in them, show nothing, but if either cell has something in it, do the math...A1+B1. So I wrote: if(A1+B1="","",A1+B1). Unfortunately, it'll do the math, but it shows a zero for the rows that have no input. Can someone help?? And explain why?? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sum if statement with a left statement | Excel Discussion (Misc queries) | |||
Can an If statement answer an If statement? | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions | |||
If statement and Isblank statement | Excel Worksheet Functions | |||
Help please, IF statement/SUMIF statement | Excel Worksheet Functions |