#1   Report Post  
Mark
 
Posts: n/a
Default If statements

Not exactly sure how to pose this question, but what I'm trying to do is use
different if statements based on a value. eg. if students in class "a" then
use if formula "1", if not use if formula 2.... Where each formual is a
series of 5 or 6 if statements . 90 and above, A;80 and above B; etc...


  #2   Report Post  
crispbd
 
Posts: n/a
Default


If the grades are in column A, this function gives Letter Grades
according to:
= 90, A
= 80 (less than 90), B
=70, C
= 50, D

< 50, F


=IF(A1=90,"A",IF(A180,"B",IF(A170,"C",IF(A1=50 ,"D","F"))))


--
crispbd
------------------------------------------------------------------------
crispbd's Profile: http://www.excelforum.com/member.php...o&userid=10880
View this thread: http://www.excelforum.com/showthread...hreadid=274338

  #3   Report Post  
mzehr
 
Posts: n/a
Default

Hi Mark,
Another way:
=VLOOKUP(A1,{0,"F";50,"D";70,"C";80,"B";90,"A"},2)
Put that formula in B1 (assuming that your 1st grade is in A1) and copy down.

Another way:
create a table in say d1:e5
0 F
50 D
70 C
80 B
90 A

and use this formula:
=VLOOKUP(A1,$D$1:$E$5,2)
The advantage of using a lookup table is that you can easily change one
grade value, and your grades will all automatically recalculate.


"Mark" wrote:

Not exactly sure how to pose this question, but what I'm trying to do is use
different if statements based on a value. eg. if students in class "a" then
use if formula "1", if not use if formula 2.... Where each formual is a
series of 5 or 6 if statements . 90 and above, A;80 and above B; etc...


  #4   Report Post  
susan hayes
 
Posts: n/a
Default

I am having difficulty with the following IF statement I wrote in VBA:

I needed to enter another country (Thailand) to my list of original
countries as follows:

ElseIf country = "Thailand" Then
Cells(60, "B") = "TB"
Cells(61, "B") = "Thailand Batt"
Cells(63, "B") = "THB"

However when the word Thailand was entered on cell B6 it did not
execute the needed results in cells B60, B61 and B63, even though it
would work when I entered all the other countries names in cell B6. I
do not understand why this happened?

Susan


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim country As String
country = Cells(6, "B").Value

If country = "United Kingdom" Then
Cells(60, "B") = "LN"
Cells(61, "B") = "British Pound"
Cells(63, "B") = "GBp"
ElseIf country = "Hong Kong" Then
Cells(60, "B") = "HK"
Cells(61, "B") = "Hong Kong Dollar"
Cells(63, "B") = "HKD"
ElseIf country = "Australia" Then
Cells(60, "B") = "AU"
Cells(61, "B") = "Australian Dollar"
Cells(63, "B") = "AUD"
ElseIf country = "Belgium" Then
Cells(60, "B") = "BB"
Cells(61, "B") = "Euro"
Cells(63, "B") = "EUR"
ElseIf country = "Denmark" Then
Cells(60, "B") = "DC"
Cells(61, "B") = "Danish Krone"
Cells(63, "B") = "DNK"
ElseIf country = "Finland" Then
Cells(60, "B") = "FH"
Cells(61, "B") = "Euro"
Cells(63, "B") = "EUR"
ElseIf country = "France" Then
Cells(60, "B") = "FP"
Cells(61, "B") = "Euro"
Cells(63, "B") = "EUR"
ElseIf country = "Germany" Then
Cells(60, "B") = "GR"
Cells(61, "B") = "Euro"
Cells(63, "B") = "EUR"
ElseIf country = "Italy" Then
Cells(60, "B") = "IM"
Cells(61, "B") = "Euro"
Cells(63, "B") = "EUR"
ElseIf country = "Japan" Then
Cells(60, "B") = "JT"
Cells(61, "B") = "Japanese Yen"
Cells(63, "B") = "JPY"
ElseIf country = "Netherlands" Then
Cells(60, "B") = "NA"
Cells(61, "B") = "Euro"
Cells(63, "B") = "EUR"
ElseIf country = "New Zealand" Then
Cells(60, "B") = "NZ"
Cells(61, "B") = "New Zealand Dollar"
Cells(63, "B") = "NZD"
ElseIf country = "Norway" Then
Cells(60, "B") = "NO"
Cells(61, "B") = "Norwegian Krone"
Cells(63, "B") = "NOK"
ElseIf country = "Singapore" Then
Cells(60, "B") = "SP"
Cells(61, "B") = "Singapore Dollar"
Cells(63, "B") = "SPD"
ElseIf country = "South Africa" Then
Cells(60, "B") = "SJ"
Cells(61, "B") = "South African Rand"
Cells(63, "B") = "RAD"
ElseIf country = "Spain" Then
Cells(60, "B") = "SM"
Cells(61, "B") = "Euro"
Cells(63, "B") = "EUR"
ElseIf country = "Sweden" Then
Cells(60, "B") = "SE"
Cells(61, "B") = "Swedish Krona"
Cells(63, "B") = "SEK"
ElseIf country = "Switzerland" Then
Cells(60, "B") = "SW"
Cells(61, "B") = "Swiss Franc"
Cells(63, "B") = "CHF"

***Missing part shown above entered here***

Else: Cells(60, "B") = ""
Cells(61, "B") = ""
Cells(63, "B") = ""
End If

End Sub





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLOOKUP statements Jennifer Kramer Excel Discussion (Misc queries) 1 January 20th 05 05:51 AM
if then statements Atlanta Rudy Excel Discussion (Misc queries) 4 January 6th 05 04:11 PM
Can you stop charts from plotting logic statements as 0 Newbeetle Charts and Charting in Excel 1 December 15th 04 10:34 AM
Macro to find and delete all FALSE statements Woody13 Excel Discussion (Misc queries) 3 December 8th 04 11:16 PM
nested statements Sherri New Users to Excel 6 December 3rd 04 07:04 PM


All times are GMT +1. The time now is 12:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"