Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2006

Tip: Looking for answers? Try searching our database.

Problem with IF function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Seamus Conlon - 18 Jan 2006 10:10 GMT
I have a puzzling problem when using the IF function.  My spreadsheet
looks like this:

Date          Value          1             2            3             4
1/2006       100
4/2006        450
3/2006        235

If the month in the date in column A matches the month number in the top
row I want to put the value from column B under the matching month
column otherwise I want to insert a zero. So, in the above example, 100
would go in cell C2, 450 in cell F3 etc.  Some date cells will be blank
and I have found that if I use a simple formula like:

=IF(MONTH($A2)=C$1,$B2,"0")

in the cells, the rows with blank dates will always have the value inserted
in column C, i.e it seems like the MONTH function returns a 1 if the date
is blank. So, I figured that I needed a formula like

=IF(ISBLANK($A2)  = FALSE AND MONTH($A2)=C$1,$B2,"0")

but this gives an error.  I have tried a few variations of this with
brackets etc
but I always get an error.

I can't see what is wrong with it!

Thanks for any help.

Seamus
Bob Phillips - 18 Jan 2006 10:21 GMT
=IF(AND(NOT(ISBLANK(A2)),MONTH($A2)=C$1),$B2,"0")

Signature

HTH

Bob Phillips

(remove nothere from email address if mailing direct)

> I have a puzzling problem when using the IF function.  My spreadsheet
> looks like this:
[quoted text clipped - 27 lines]
>
> Seamus
Seamus Conlon - 18 Jan 2006 11:12 GMT
Thanks Bob, that did the trick.

As usual it was my fault for not looking up the correct use of AND, I had
never used it before in any formula.

Seamus

> =IF(AND(NOT(ISBLANK(A2)),MONTH($A2)=C$1),$B2,"0")
>
[quoted text clipped - 30 lines]
>>
>> Seamus
Bob Phillips - 18 Jan 2006 11:41 GMT
That one was a bit unusual in that you had to add the NOT to get the result.

Signature

HTH

Bob Phillips

(remove nothere from email address if mailing direct)

> Thanks Bob, that did the trick.
>
[quoted text clipped - 37 lines]
> >>
> >> Seamus
RagDyeR - 18 Jan 2006 15:26 GMT
OR ... how about simply using:

=IF(AND($A2<>"",MONTH($A2)=C$1),$B2,"0")

?

Regards,

RD
----------------------------------------------------------------------------
-------------------
Please keep all correspondence within the Group, so all may benefit !
----------------------------------------------------------------------------
-------------------

That one was a bit unusual in that you had to add the NOT to get the result.

Signature

HTH

Bob Phillips

(remove nothere from email address if mailing direct)

> Thanks Bob, that did the trick.
>
[quoted text clipped - 14 lines]
> >>
> >> If the month in the date in column A matches the month number in the
top
> >> row I want to put the value from column B under the matching month
> >> column otherwise I want to insert a zero. So, in the above example, 100
[quoted text clipped - 6 lines]
> > inserted
> >> in column C, i.e it seems like the MONTH function returns a 1 if the
date
> >> is blank. So, I figured that I needed a formula like
> >>
[quoted text clipped - 9 lines]
> >>
> >> Seamus
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.