+ Reply to Thread
Results 1 to 10 of 10

What is wrong with this IF formula

  1. #1
    Registered User
    Join Date
    12-27-2011
    Location
    Bangladesh
    MS-Off Ver
    Excel 2016
    Posts
    65

    Exclamation What is wrong with this IF formula

    Hi Everyone.

    I am new in Excel, so my question appears to be silly to you.

    Anyway, I want to frame a simple logic with IF
    IF K2=0, "Science"
    IF K2=2, "Humanities"
    IF K2=8, "Business"

    I have made this formula
    =IF(K2=0,"Science",IF(K2=2,"Humanities",”Business”))
    But it is showing #Name error
    Why?

    What should be the correct formula?

    Regards
    Haque

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: What is wrong with this IF formula

    it is ok, but look at red =IF(K2=0,"Science",IF(K2=2,"Humanities","Business")) in yours formula

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: What is wrong with this IF formula

    You could also probably do this with a vlookup...
    =vlookup(K2,$X$1:$Z$3,2,0)
    with X1:X3 containing the values and Z1:Z3 containing the "answer"
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    12-27-2011
    Location
    Bangladesh
    MS-Off Ver
    Excel 2016
    Posts
    65

    Re: What is wrong with this IF formula

    Quote Originally Posted by sandy666 View Post
    it is ok, but look at red =IF(K2=0,"Science",IF(K2=2,"Humanities","Business")) in yours formula
    What should be the formula, then?

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: What is wrong with this IF formula

    Also can be: =CHOOSE(IFERROR(MATCH(K2,{0,2},0),3),"Science","Humanities","Business")

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: What is wrong with this IF formula

    Formula is ok, but last quotation marks are wrong.
    yours: =IF(K2=0,"Science",IF(K2=2,"Humanities",Business))
    should be: =IF(K2=0,"Science",IF(K2=2,"Humanities","Business"))

    edit:
    yours quotation mark is from MS Word probably
    Last edited by sandy666; 03-28-2017 at 03:42 PM.

  7. #7
    Forum Contributor
    Join Date
    08-04-2004
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    186

    Re: What is wrong with this IF formula

    Quote Originally Posted by mfhaq77 View Post
    What should be the formula, then?
    Your formula is correct but the quotes you have around business are not the right ones. I don't know what they are but replace them with the right ones and it works

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: What is wrong with this IF formula

    Quote Originally Posted by philaugust2004 View Post
    Your formula is correct but the quotes you have around business are not the right ones. I don't know what they are but replace them with the right ones and it works
    They probably come from a Word document

  9. #9
    Forum Contributor
    Join Date
    08-04-2004
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    186

    Re: What is wrong with this IF formula

    Quote Originally Posted by FDibbins View Post
    They probably come from a Word document
    You'd think Microsoft would be able to get that bit right!

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: What is wrong with this IF formula

    look at who you are talking about

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Doing Something Wrong with IF & OR & AND Formula -- Again
    By Leathermyth in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-05-2014, 11:29 PM
  2. [SOLVED] What is wrong with this formula?
    By AAAAmy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-01-2012, 10:21 PM
  3. What's wrong with my formula?
    By oddcarout in forum Excel General
    Replies: 0
    Last Post: 05-05-2009, 12:03 PM
  4. What's wrong with my formula?
    By amsnss in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-07-2007, 01:34 PM
  5. ###### Wrong Formula
    By Ningster in forum Excel General
    Replies: 8
    Last Post: 07-07-2006, 08:15 PM
  6. [SOLVED] What is wrong with this formula?
    By grinlrar in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-01-2005, 06:05 AM
  7. What is wrong with this formula?
    By zolo33 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2005, 11:54 PM

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