+ Reply to Thread
Results 1 to 6 of 6

If function for multiple options?

Hybrid View

sbweld If function for multiple... 10-31-2006, 06:37 PM
VBA Noob Hi, The If statement is ok... 10-31-2006, 06:40 PM
sbweld hey thanks for your quick... 10-31-2006, 06:46 PM
VBA Noob Hi, If the cells have to... 10-31-2006, 06:54 PM
sbweld Awesome!!! 10-31-2006, 07:03 PM
VBA Noob Glad I could point you in the... 10-31-2006, 07:04 PM
  1. #1
    Registered User
    Join Date
    10-31-2006
    Posts
    3

    If function for multiple options?

    Hello,

    I am trying to build a spreadsheet that calculates a GPA.

    Basically what I have is the letter grades in the C column and the value of the letter grades in D column. Instead of entering the letter grade and then the value of the letter grade, I want excel to know what the value of each letter grade is and display it accordingly in the next column.

    I can figure out how to make it work with one letter:
    =IF(($C2="A"),"4.0","")

    I want to add in

    =IF((C2="A-"),"3.7","")

    along with

    =IF((C2="B+"),"3.3","")

    etc.

    Is the IF function the wrong function to do this with? How could I go about doing something like this?

    Thanks a lot for your help
    Sean

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    The If statement is ok up to 7 statements. Can you post all your criteria's

    VBA Noob

  3. #3
    Registered User
    Join Date
    10-31-2006
    Posts
    3
    hey thanks for your quick response.

    A=4.0
    A-=3.7
    B+=3.3
    B=3.0
    B-=2.7
    C+=2.3
    C=2.0

    Those are all the criteria. So basically if the letter in C2 is equal to one of the letters shown above, i want the data in D2 to return the value of the letter grade. If it doesn't equal the letter shown above (which it never would, unless of course maybe a typo) i guess it could return ERROR or something like that.

    Thanks again
    Sean

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    If the cells have to match your values then this should work

    =IF(C2=2,"C",IF(C2=2.3,"C+",IF(C2=2.7,"B-",IF(C2=3,"B",IF(C2=3.3,"B+",IF(C2=3.7,"A-",IF(C2=4,"A","")))))))

    if you meant e.g less that 2.2 = C then let me know

    VBA Noob

  5. #5
    Registered User
    Join Date
    10-31-2006
    Posts
    3

    Awesome!!!

    Thanks VBA Noob.

    I actually meant it to be the other way around (value based on letter):

    =IF(C2="C+","2.3",IF(C2="B-","2.7",IF(C2="B","3.0",IF(C2="B+","3.3",IF(C2="A-","3.7",IF(C2="A","4.0",""))))))

    but it obviously didn't take too much brain power to figure out how to switch it.

    Thanks again
    Sean

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Glad I could point you in the right direction

    VBA Noob

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1