Computing.Net > Forums > Windows XP > Writing a IF statement

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Writing a IF statement

Reply to Message Icon

Name: Timothy Brown
Date: March 2, 2009 at 14:04:51 Pacific
OS: Windows XP
CPU/Ram: 4GB
Product: Dell Gx110
Subcategory: General
Comment:

Am taking a class but cannot seem to get IF statement right. If cell C4 bronze= none, silver=3000, gold=5000 and platinum=10000. The statement I tried is =IF(C4,"Bronze","None",IF(C4,"Silver","3000",IF(C4,"Gold","5000",IF(C4,"Platinum","10000")))) comes up to many arguments. Please help!!!!



Sponsored Link
Ads by Google

Response Number 1
Name: SongCloud
Date: March 2, 2009 at 14:20:51 Pacific
Reply:

Hello there. I assume you are talking about an IF command in a program like Excel??

If you are, I have some questions for you.

First, are you trying to look for the names (bronze, silver, gold,etc) in the cells or are you trying to look for the numerical values in the cells?

Either way your code has errors as it does have too many arguments per line. For an IF statement you should have the following outline:

IF(logical_test, value_if_true, value_if_false)

These can be nested by substituting another IF statement in place of the "Value_if_true" and/or "Value_if_false" sections.

Let me know if you need more assistance.


0

Response Number 2
Name: aegis1
Date: March 2, 2009 at 15:01:22 Pacific
Reply:

For future reference, Excel questions belong in the Office Software forum.


0

Response Number 3
Name: Timothy Brown
Date: March 2, 2009 at 15:14:45 Pacific
Reply:

Thanks for responding. Yes it is Excel and I am searching for the words bronze, silver, gold and platinum in cell C4. Each word has a corresponding value to be entered if found, Bronze=none, silver=3000, gold=5000 and platinum=10000. Yes I need more help. Thanks again.


0

Response Number 4
Name: SongCloud
Date: March 2, 2009 at 16:19:49 Pacific
Reply:

No Problem.

For the IF statements, you would need to do an actual logical test. The code that you wrote was almost correct, but you had "," between the cell(s) that you wanted to test and the value that you wanted to test for. This is why it was giving you the error. If we look at the first part of what you wrote, it was looking at testing cell C4, but it didn't know what to test cell C4 for. Then the next thing it saw was "bronze" for the "Value_if_true" section, and "None" for the "Value_if_false" section. If you had stopped here, the formula would have returned a "#VALUE!" error. This is due to not having a valid logical test.

To fix the code in this example, you would use

=IF(C4="Bronze","None", IF(C4="Silver", 3000, IF(C4="Gold", 5000, IF(C4="Platinum", 10000, "Error"))))

Note that I included the "error" entry in there as you need something to ensure that if none of test result in a "true" outcome, that the formula does not throw an actual error.

Please let me know if you need more explanation. I hope I have helped you with your class. :)

Funny as I am teaching an Excel class tomorrow. :)


------
MOS Master Certified
MCP Certified
CCNA Certificate Pending
A+ Certificate Pending

"I have gone to find myself. If I get back before I return, please tell myself to wait." :


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Writing a IF statement

The IF Statement www.computing.net/answers/windows-xp/the-if-statement/177858.html

Writing a DVD-RW www.computing.net/answers/windows-xp/writing-a-dvdrw/162819.html

if statement excel www.computing.net/answers/windows-xp/if-statement-excel/95823.html