Index: src/func.c
===================================================================
--- src/func.c	(revision 17073)
+++ src/func.c	(working copy)
@@ -1010,6 +1010,42 @@
 			value_release (values [i]);
 }
 
+static GnmValue *
+gnumeric_if2 (GnmFuncEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
+{
+	gboolean err;
+	int i, branch;
+	GnmValue *args[3];
+	GnmValue *res;
+
+	g_return_val_if_fail (argc >= 1 && argc <= 3,
+			      value_new_error_VALUE (ei->pos));
+
+	/* Evaluate condition.  */
+	res = gnm_expr_eval (argv[0], ei->pos, 0);
+	if (VALUE_IS_ERROR (res))
+		return res;
+	args[0] = res;
+
+	branch = value_get_as_bool (args[0], &err) ? 1 : 2;
+	for (i = 1; i <= 2; i++) {
+		args[i] = argc > i
+			? (branch == i ?
+			   gnm_expr_eval (argv[branch], ei->pos, 0)
+			   : value_new_empty ())
+			: NULL;
+	}
+
+	/* This actually calls gnumeric_if.  */
+	res = ei->func_call->func->fn.args.func (ei, (GnmValue const * const *)args);
+
+	free_values (args, 3);
+
+	return res;
+}
+
+/* ------------------------------------------------------------------------- */
+
 /**
  * function_call_with_exprs:
  * @ei: EvalInfo containing valid fn_def!
@@ -1029,6 +1065,7 @@
 	int	 *iter_item = NULL;
 	int argc;
 	GnmExprConstPtr *argv;
+	static GnmFunc *fn_if;
 
 	g_return_val_if_fail (ei != NULL, NULL);
 	g_return_val_if_fail (ei->func_call != NULL, NULL);
@@ -1053,6 +1090,13 @@
 		      (flags & GNM_EXPR_EVAL_PERMIT_NON_SCALAR))
 		? 0 : -1;
 
+	if (fn_if == NULL) {
+		fn_if = gnm_func_lookup ("if", NULL);
+	}
+
+	if (fn_def == fn_if && iter_count == -1)
+		return gnumeric_if2 (ei, argc, argv);
+
 	for (i = 0; i < argc; i++) {
 		char arg_type = fn_def->fn.args.arg_types[i];
 		/* expr is always non-null, missing args are encoded as
