IF() Function Syntax Option

Colin Legg

MrExcel MVP
Joined
Feb 28, 2008
Messages
3,507
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Syntax said:
IF(logical_test, [value_if_true], [value_if_false])



I noted today that in the helpfile topic for the IF() worksheet function it is possible to omit both the function's 2nd and 3rd arguments.

Although to do so you have to add a comma after the logical_test, eg:
Code:
=IF(A1="hello",)

When both [value_if_true] and [value_if_false] arguments are omitted the function always returns 0 if the condition is met or FALSE() if the condition is not met (unless the condition references an error value in which case an error is returned).

Can anyone think of an instance where using the IF() function like this could be remotely useful?

Note - I'm comfortable with leaving one of these arguments out, just can't think of a valid application for leaving both out. Just a feeling in the back of my mind that the fact that IF() in this format is able to return different data types (number vs logical depending on condition=TRUE vs FALSE) might mean that there could be a clever use for it?

Cheers,
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,222,617
Messages
6,167,074
Members
452,094
Latest member
Roberto Saveru

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