ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF STATEMENT (https://www.excelbanter.com/excel-worksheet-functions/194438-if-statement.html)

Charlie

IF STATEMENT
 
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(B170) then look at the above
function???

Fred Smith[_4_]

IF STATEMENT
 
You want the AND function, as in:
=IF(and(b170,B17=B2),1,MONTH($B$2)-MONTH(B17))

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

Regards,
Fred

"charlie" wrote in message
...
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(B170) then look at the above
function???



Charlie

IF STATEMENT
 
OK, I did that, but if the cell is blank it's still returning a 5, but I want
it to return a zero.

"Fred Smith" wrote:

You want the AND function, as in:
=IF(and(b170,B17=B2),1,MONTH($B$2)-MONTH(B17))

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

Regards,
Fred

"charlie" wrote in message
...
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(B170) then look at the above
function???




Lars-Åke Aspelin[_2_]

IF STATEMENT
 
On Thu, 10 Jul 2008 12:34:15 -0700, charlie
wrote:

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(B170) 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

Gary Brown[_4_]

IF STATEMENT
 
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


"charlie" wrote:

OK, I did that, but if the cell is blank it's still returning a 5, but I want
it to return a zero.

"Fred Smith" wrote:

You want the AND function, as in:
=IF(and(b170,B17=B2),1,MONTH($B$2)-MONTH(B17))

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

Regards,
Fred

"charlie" wrote in message
...
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(B170) then look at the above
function???




Charlie

IF STATEMENT
 
I don't know what you mean...

"Gary Brown" wrote:

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


"charlie" wrote:

OK, I did that, but if the cell is blank it's still returning a 5, but I want
it to return a zero.

"Fred Smith" wrote:

You want the AND function, as in:
=IF(and(b170,B17=B2),1,MONTH($B$2)-MONTH(B17))

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

Regards,
Fred

"charlie" wrote in message
...
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(B170) then look at the above
function???



Charlie

IF STATEMENT
 
THAT'S IT!!! Thanks so much!!!!!!!

"Lars-Ã…ke Aspelin" wrote:

On Thu, 10 Jul 2008 12:34:15 -0700, charlie
wrote:

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(B170) 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



All times are GMT +1. The time now is 04:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com