If formula results in an error, how do I make a zero appear

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,352
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a formula. If the result is an error, how do I make a 0 appear?

Excel Formula:
=IF(E5="Activities",0,[Price 
ex. GST]*0.1)

I tried this but it won't work
Excel Formula:
=IFERROR(IF(E5="Activities",0,[Price 
ex. GST]*0.1),0)
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
try

=IFERROR(IF(E5="Activities",0,[Price
ex. GST]*0.1),"")
 
Upvote 0
That doesn't work. If I change the width of the column, it changes what part of the formula that is visible

Here are some screenshots, all with the same formula, just changed column(K) width.

1603408495277.png





Width 14
1603408746077.png




width 16
1603408608686.png



width 19.14
1603408663281.png
 

Attachments

  • 1603408477965.png
    1603408477965.png
    2.5 KB · Views: 1
Upvote 0
Is the table name
[Price ex. GST]
correct ???
 
Upvote 0
After further testing I have found that I get the #VALUE! error in those K5 and L5 (first row of my table) if I run the following code to delete all lines, I get the displayed image

VBA Code:
Sub CostingDeleteAll()
    'Deleting The Data In A Table
    Dim tbl As ListObject
    Dim cell As Range
        Set tbl = ThisWorkbook.Worksheets("Costing_tool").ListObjects("tblCosting")
        'Delete all table rows except first row
        With tbl.DataBodyRange
            If .Rows.Count > 1 Then
                .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count).Rows.Delete
            End If
            'Clear the contents, but not delete the formulas
            For Each cell In tbl.ListRows(1).Range.Cells
                If Not cell.HasFormula Then
                    cell.Value = ""
                End If
            Next
        End With
End Sub
CSS_quoting_tool_31.8.xlsm
ABCDEFGHIJKLMNOP
223/10/2020#######
4DatePurchase order #Quote Ref #NameServiceRequesting OrganisationCaseworker NameAllocated toWait Time/HrsPrice ex. GSTGSTPrice inc. GSTDate report receivedDate report sentAllocated byReport sent by
5#VALUE!#VALUE!
6
Costing_tool
Cell Formulas
RangeFormula
A2:B2A2=TODAY()
K5K5=IF(E5="Activities",0,[Price ex. GST]*0.1)
L5L5=IF(E5="Activities",[@[Price ex. GST]],[GST]+[Price ex. GST])
Cells with Data Validation
CellAllowCriteria
D5,A5,G5:I5Any value
G5:I5Any value




But if I run the following code to delete 1 line, the resulting table will look like this
VBA Code:
Sub DeleteCostingLine()
    Dim ws As Worksheet
    Dim tbl As ListObject
        Set ws = ActiveSheet
        Set tbl = ws.ListObjects("tblCosting")

    tbl.ListRows(tbl.ListRows.Count).Delete
    'Worksheets("Costing_tool").Range("AB5").Value = "1"
End Sub
CSS_quoting_tool_31.8.xlsm
ABCDEFGHIJKLMNO
223/10/2020#######
4DatePurchase order #Quote Ref #NameServiceRequesting OrganisationCaseworker NameAllocated toWait Time/HrsPrice ex. GSTGSTPrice inc. GSTDate report receivedDate report sentAllocated by
5
6
Costing_tool
Cell Formulas
RangeFormula
A2:B2A2=TODAY()
Cells with Data Validation
CellAllowCriteria
D5,A5,G5:I5Any value
G5:I5Any value



Why does one make nothing appear in the formula cells and the other give me a #VALUE! error when they are supposed to do very similar things. I do not want the error to appear.
 
Upvote 0
But shouldn't the PriceexGST have a cell reference ??
 
Upvote 0
But shouldn't the PriceexGST have a cell reference ??
It is the name of the column. It is not using cell references, but it is a specific excel table and it is using table references.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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