如果“0”,則保持單元格為空

[英]If “0” then leave the cell blank


I am trying to create a simple ledger and on the far right of the "Book" it totals any debit/credit that I input. But instead of leaving the unused rows blank, it keeps repeating the latest total to the bottom of the page.

我正在嘗試創建一個簡單的分類賬,在“Book”的最右邊,我輸入的所有借方/貸方之和。但是,它沒有保留未使用的行為空,而是不斷地在頁面底部重復最新的總數。

How Can I make that cell blank if the equation equals 0?

如果方程等於0,我怎么能讓這個單元格為空?

=H15+G16-F16 

is the formula I am currently using.

是我目前使用的公式。

5 个解决方案

#1


19  

You can change the number format of the column to this custom format:

您可以將列的編號格式更改為此自定義格式:

0;-0;;@

which will hide all 0 values.

它將隱藏所有的0值。

To do this, select the column, right-click > Format Cells > Custom.

為此,選擇列,右鍵單擊>格式單元格>自定義。

#2


6  

Use =IF(H15+G16-F16=0,"",H15+G16-F16)

使用=如果(H15 + G16-F16 = 0”“H15 + G16-F16)

#3


1  

An accrual ledger should note zeroes, even if that is the hyphen displayed with an Accounting style number format. However, if you want to leave the line blank when there are no values to calculate use a formula like the following,

權責發生制分類帳應該注意到零,即使那是用會計風格編號格式顯示的連字符。但是,如果您想要在沒有需要計算的值時將該行留空,請使用如下公式,

 =IF(COUNT(F16:G16), SUM(G16, INDEX(H$1:H15, MATCH(1e99, H$1:H15)), -F16), "")

That formula is a little tricky because you seem to have provided your sample formula from somewhere down into the entries of the ledger's item rows without showing any layout or sample data. The formula I provided should be able to be put into H16 and then copied or filled to other locations in column H but I offer no guarantees without seeing the layout.

這個公式有點棘手,因為您似乎已經將示例公式從某個地方提供到分類帳項目行的條目中,而沒有顯示任何布局或示例數據。我提供的公式應該可以放在H16中,然后在H列中復制或填充到其他位置,但是我不能保證沒有看到布局。

If you post some sample data or a publicly available link to a screenshot showing your data layout more specific assistance could be offered. http://imgur.com/ is a good place to host a screenshot and it is likely that someone with more reputation will insert the image into your question for you.

如果您向顯示數據布局的屏幕截圖發布一些示例數據或公開的鏈接,可以提供更具體的幫助。http://imgur.com/是一個展示截圖的好地方,很有可能有更有名氣的人會把圖片插入到你的問題中。

#4


1  

Your question is missing most of the necessary information, so I'm going to make some assumptions:

你的問題缺少了大部分必要的信息,所以我要做一些假設:

  1. Column H is your total summation
  2. H列是總和
  3. You're putting this formula into H16
  4. 把這個公式代入H16
  5. Column G is additions to your summation
  6. 列G是對求和的補充。
  7. Column F is deductions from your summation
  8. F列是求和的減法
  9. You want to leave the summation cell blank if there isn't a debit or credit entered
  10. 如果沒有一個借方或貸方進入,你想要離開求和單元。

The answer would be:

答案是:

=IF(COUNTBLANK(F16:G16)<>2,H15+G16-F16,"")

COUNTBLANK tells you how many cells are unfilled or set to "".
IF lets you conditionally do one of two things based on whether the first statement is true or false. The second comma separated argument is what to do if it's true, the third comma separated argument is what to do if it's false.
<> means "not equal to".

The equation says that if the number of blank cells in the range F16:G16 (your credit and debit cells) is not 2, which means both aren't blank, then calculate the equation you provided in your question. Otherwise set the cell to blank("").
When you copy this equation to new cells in column H other than H16, it will update the row references so the proper rows for the credit and debit amounts are looked at.

CAVEAT: This equation is useful if you are just adding entries for credits and debits to the end of a list and want the running total to update automatically. You'd fill this equation down to some arbitrary long length well past the end of actual data. You wouldn't see the running total past the end of the credit/debit entries then, it would just be blank until you filled in a new credit/debit entry. If you left a blank row in your credit debit entries though, the reference to the previous total, H15, would report blank, which is treated like a 0 in this case.

COUNTBLANK告訴您有多少單元格未填充或設置為“”。如果讓你有條件地做兩件事中的一件,基於第一個命題是真還是假。第二個逗號分隔的參數是如果它是真的,第三個逗號分隔的參數是如果它是假的,該怎么做。<>表示“不等於”。公式中說,如果在F16:G16(你的信用卡和借記卡賬戶)范圍內的空白單元數不是2,也就是說兩者都不是空白的,那么計算出你在問題中提供的方程。否則將單元格設置為空(“”)。當您將這個等式復制到H16以外的H列中的新單元時,它將更新行引用,以便查看信用和借方數量的正確行。注意:如果您只是在列表的末尾添加積分和借位項,並希望運行的總數自動更新,那么這個等式是有用的。你可以把這個方程填到一個任意的長長度,直到實際數據結束。當你填寫新的信用/借貸分錄時,你不會看到超過貸方/借方分錄的運行總數。但是,如果您在您的信用卡借記條目中留了一個空行,則對之前的總數H15的引用將報告為空,在這種情況下,這將被視為0。

#5


0  

An example of an IF Statement that can be used to add a calculation into the cell you wish to hide if value = 0 but displayed upon another cell value reference.

一個IF語句的示例,該語句可用於將計算添加到您希望隱藏IF值為0但在另一個單元格值引用上顯示的單元格中。

=IF(/Your reference cell/=0,"",SUM(/Here you put your SUM/))

=IF(/您的引用單元格/=0,"",SUM(/您的SUM/)


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2015/08/23/3e8bdd9a654d8ce5393190ade8dcd578.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com