Ask Your Question

Revision history [back]

It's fairly simple to literally translate your requirements

if B2 or C2 is empty the result is empty, but otherwise C2 is divided by B2

to a formula

=IF(OR(ISBLANK(B2),ISBLANK(C2)),"",C2/B2)

I think your question is good and precise, but the headline is misleading, because User-Defined Functions has to do with using macros to defined named functions, whereas your problem can be solved just fine with a simple formula.

(If this works for you, please click on the ✓ to accept the answer.)

It's fairly simple to literally translate your requirements

if B2 or C2 is empty the result is empty, but otherwise C2 is divided by B2

to a formula

=IF(OR(ISBLANK(B2),ISBLANK(C2)),"",C2/B2)
=IF(OR(ISBLANK(B2); ISBLANK(C2)); ""; C2/B2)

I think your question is good and precise, but the headline is misleading, because User-Defined Functions has to do with using macros to defined named functions, whereas your problem can be solved just fine with a simple formula.

(If this works for you, please click on the ✓ to accept the answer.)

It's fairly simple to literally translate your requirements

if B2 or C2 is empty the result is empty, but otherwise C2 is divided by B2

to a formula

=IF(OR(ISBLANK(B2); ISBLANK(C2)); ""; =IF(OR(ISBLANK(B2), ISBLANK(C2)), "", C2/B2)

I think your question is good and precise, but the headline is misleading, because User-Defined Functions has to do with using macros to defined named functions, whereas your problem can be solved just fine with a simple formula.

(If this works for you, please click on the ✓ to accept the answer.)