empty cells issue - possible formatting or formula issue

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi

I have a file which has 2 sheets. One is called FORM and another called Details. in the Details sheet, in the second cell, I have the following formula:

=IF(FORM!A2<>0,FORM!A2,IF(FORM!B2<>0,-FORM!B2,0))

Everything is working fine. I created these tables by myself in a new file but I have similar situation with a real file (not mine) which has exactly the same 2 sheets. What is the problem with the real file, if I do not put 0 in the "debit" then the Result column (first 5 cells) will be empty. I checked the format of all cells, Debit and Credit columns are type of Custom, while the Result column is type of Number. I tried to change all to different formats but could not get it work

FORM sheet
[TABLE="class: grid, width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]debit[/TD]
[TD="width: 64"]credit[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]30[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]40[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]50[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]20[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]30[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]40[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]50[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Details Sheet

The formula in the second cell is =IF(FORM!A2<>0,FORM!A2,IF(FORM!B2<>0,-FORM!B2,0))

[TABLE="class: grid, width: 64"]
<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]result[/TD]
[/TR]
[TR]
[TD="align: right"]-10[/TD]
[/TR]
[TR]
[TD="align: right"]-20[/TD]
[/TR]
[TR]
[TD="align: right"]-30[/TD]
[/TR]
[TR]
[TD="align: right"]-40[/TD]
[/TR]
[TR]
[TD="align: right"]-50[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]30[/TD]
[/TR]
[TR]
[TD="align: right"]40[/TD]
[/TR]
[TR]
[TD="align: right"]50[/TD]
[/TR]
</tbody>[/TABLE]
 
but I am just curious now, why you decided to put -- infront of the formula?

Because when I dragged the formula down the positive results were numbers stored as text (which I don't like unless I have to).

The double negation just converts it to real numbers (or converts TRUE/FALSE to 1/0) in the same way that adding a +0 or *1 to the formula or wrapping the whole formula in a VALUE() function would.

Double negation is supposedly just fractionally more efficient than the other methods.
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top