is there any formula IFZERO which is similar like IFERROR

harinsh

Active Member
Joined
Feb 7, 2012
Messages
273
Hi Team,

Is there any formula in excel like IFZERO which is similar like IFERROR....return the require value if formula is ZERO....I just googled it but not found...can anyone help by creating in UDF or share if any other formula to get the desire output.


Thank you,
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I think this UDF will work, simply pass it the expression to evaluate as the first argument and what you want returned if that evaluation is 0...
Code:
Function IFZERO(Expr As Variant, ValIfZero As Variant) As Variant
  Dim Calc As Variant
  Calc = Evaluate(Expr)
  If Calc = 0 Then
    IFZERO = Evaluate(ValIfZero)
  Else
    IFZERO = Evaluate(Expr)
  End If
End Function
 
Upvote 0
You can use IFERROR with a minor twist:

=IFERROR(1/(1/value),value_if_zero)

Obviously, it will also return value_if_zero if value evaluates to an empty string, text string, or error.
 
Upvote 0
The problem with the non-Macro solutions (even these are often a last resort) proposed is that having to
You can use IFERROR with a minor twist:

=IFERROR(1/(1/value),value_if_zero)

Obviously, it will also return value_if_zero if value evaluates to an empty string, text string, or error.
Clever!
 
Upvote 0
Absent any command like IFZERO, just use a basic IF formula:

=IF(value=0,"",value)
 
Upvote 0
You could drop the =0 part if you just use the FALSE part for that.

=IF(A1,A1,"Zero")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
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