IF STATEMENT

  • Thread starter Thread starter charlie
  • Start date Start date
C

charlie

I need a formula that looks at a cell and if it's not empty it preforms the
following function:
=IF(B17=B2,1,SUM(MONTH($B$2)-MONTH(B17))

B2 is set for 6/1/08, so right now if the cell is blank it returns a 5, but
I only want it to do the calculation if there's a date in the cell. How can
I add another IF statement to this to say IF(B17>0) then look at the above
function???
 
You want the AND function, as in:
=IF(and(b17>0,B17=B2),1,MONTH($B$2)-MONTH(B17))

You don't need Sum if you're only doing arithmetic.

Regards,
Fred
 
OK, I did that, but if the cell is blank it's still returning a 5, but I want
it to return a zero.
 
I need a formula that looks at a cell and if it's not empty it preforms the
following function:
=IF(B17=B2,1,SUM(MONTH($B$2)-MONTH(B17))

B2 is set for 6/1/08, so right now if the cell is blank it returns a 5, but
I only want it to do the calculation if there's a date in the cell. How can
I add another IF statement to this to say IF(B17>0) then look at the above
function???

Try this:

=IF(ISBLANK(B17), "" , your original formula goes here )

that is

=IF(ISBLANK(B17), "" , IF(B17=B2, 1, MONTH($B$2)-MONTH(B17) )

Hope this helps / Lars-Åke
 
Charlie,
You lost the Month( ) function AND testing if different years from
previous posts.
--
Hope this helps.
If this post was helpfull, please remember to click on the ''''YES''''
button at the bottom of the screen.
Thanks,
Gary Brown
 
I don't know what you mean...

Gary Brown said:
Charlie,
You lost the Month( ) function AND testing if different years from
previous posts.
--
Hope this helps.
If this post was helpfull, please remember to click on the ''''YES''''
button at the bottom of the screen.
Thanks,
Gary Brown
 
THAT'S IT!!! Thanks so much!!!!!!!

Lars-Ã…ke Aspelin said:
Try this:

=IF(ISBLANK(B17), "" , your original formula goes here )

that is

=IF(ISBLANK(B17), "" , IF(B17=B2, 1, MONTH($B$2)-MONTH(B17) )

Hope this helps / Lars-Ã…ke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top