View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default How to simplify "multiple if" formula

Perhaps this

=IF(I4="","",IF(EDATE(I4,1)$D$6,"",EDATE(I4,1)))

The problem is that OR gets evaluated even if the first condition fails, so
you get the #VALUE

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"markx" wrote in message
...
Hello,

I have a basic formula in J6 =EDATE(I6;1)

I'm try to extend this formula from J6 to the right (every cell adds one
month to the previous), but once the EDATE([...]6;1) will get bigger than
the value in cell D4, I would like to have the formula giving me "" (empty
cell).

I started with
=IF(EDATE(I4;1)$D$4;"";EDATE(I4;1))
but it's not good enough: the first cell that is bigger than $D$4 is

indeed
blank, but all the following give me #VALUE error.

So I modified to
=IF(OR(EDATE(I4;1)$D$4;ISERROR(EDATE(I4;1)));"";E DATE(I4;1))
but it's the same: first cell bigger than D4 value is blank (that's

fine!),
but then I still can't get rid of #VALUE errors that follow (:-().

So I reformulated it to
=IF(ISERROR(EDATE(I4;1));"";IF(EDATE(I4;1)$D$4;"" ;EDATE(I4;1)))
and it's functionning correctly (finally!): all the cells bigger than the
value in D4 are blank!

I'm asking however myself if I can simplify the last formula and make it
look "nicer"...
The other question I have is why the second formula (with OR argument) is
not functionning like the third...

Thank you in advance for any hints regarding this,
Regards,

Mark