![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 14
|
I am calculating the difference between two cells, but if both cells are blank it returns me 0.
How can I make it return FALSE if both cells are blank. Thanks ! Girish |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
Assuming your evaluating A1 and B1 then this would be it:
Code:
=IF(A1+B1=0,"False",A1+B1) NOTE: Testing performed on Win2K utilizing Office 2000. Solutions may need tweaking for other versions. [ This Message was edited by: Nimrod on 2002-05-13 14:09 ] |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
=IF(LEN(A1&B1),A1-B1)
[ This Message was edited by: Mark W. on 2002-05-13 14:13 ] |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
|
|
|
|
|
|
|
#5 |
|
New Member
Join Date: May 2002
Posts: 14
|
Thanks for the quick responses.
I would like to modify the question a little.. I want FALSE even if either cell is blank. |
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
where diff either A1-B1 or B1-A1. |
|
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
=IF(OR(ISBLANK(A1),ISBLANK(B1)),FALSE,A1-B1)
Or... =IF(AND(LEN(A1),LEN(B1)),A1-B1) [ This Message was edited by: Mark W. on 2002-05-13 14:26 ] |
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
Carefull Mark... what if the cell has the value zero in it .
Code:
=IF(OR(A1=0,B1=0),"False",A1-B1) _________________ NOTE: Testing performed on Win2K utilizing Office 2000. Solutions may need tweaking for other versions. [ This Message was edited by: Nimrod on 2002-05-13 14:25 ] |
|
|
|
|
|
#9 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
|
|
|
|
|
|
|
#10 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|