+ Reply to Thread
Results 1 to 10 of 10

Ms Excel 2016 IF function

Hybrid View

  1. #1
    Registered User
    Join Date
    08-13-2016
    Location
    Indonesia
    MS-Off Ver
    MS EXCEL 2016
    Posts
    20

    Ms Excel 2016 IF function

    Hello,
    I'm new to excel IF function, could someone please help me with this. I've been trying to figure out make a formula that i want it (IF FUNCTION), but no luck so far.
    so this how i want it.

    excel.jpg


    Thank you

  2. #2
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    Re: Ms Excel 2016 IF function

    Do you want it to be John that's not married, or just whatever name is in column B?

    You might need to provide a larger sample so we can see your desired results.

    Try this in cell D5 and drag it down:

    =if(C5="Married","M","NM")
    That will work if all you want is it to return M or NM based on the cell in the C column.

    I believe you are trying to return if they are married to one another, so that might require a function other than if. Once again, we need a larger sample size to see what you are actually expecting as results.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,178

    Re: Ms Excel 2016 IF function

    Formula: copy to clipboard
    =IF(C5="Married","M","NM")
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    08-13-2016
    Location
    Indonesia
    MS-Off Ver
    MS EXCEL 2016
    Posts
    20

    Re: Ms Excel 2016 IF function

    Hi,
    Thank you for replying

    I tried to do like what you told me but every time I hit enter, it gives me an error like this

    excel2.jpg

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Ms Excel 2016 IF function

    You may need to replace the commas with semi-colons:

    =IF(C5="Married";"M";"NM")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Registered User
    Join Date
    08-13-2016
    Location
    Indonesia
    MS-Off Ver
    MS EXCEL 2016
    Posts
    20

    Re: Ms Excel 2016 IF function

    Thank you so much.
    I did


  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Ms Excel 2016 IF function

    You're welcome. Thanks for the feedback!

  8. #8
    Registered User
    Join Date
    08-13-2016
    Location
    Indonesia
    MS-Off Ver
    MS EXCEL 2016
    Posts
    20

    Re: Ms Excel 2016 IF function

    oh . oh . oh .
    How about if I wanna do it like this ?

    excel3.jpg

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Ms Excel 2016 IF function

    Try this
    Formula: copy to clipboard
    =LOOKUP(8^5;SEARCH({"Married";"Not Married";"Divorced"};C5);{"M";"NM";"P"})

    v B C D E
    5 John Married M
    6 Scott Not Married NM
    7 Bobby Divorced P
    8 Scott Divorced P
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  10. #10
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Ms Excel 2016 IF function

    Well, before you embark on writing a formula for a problem, do something that's called "planning".

    That will save you and others a lot of time.

    So, what options will there be?

    - married (M)
    - not married (NM)
    - divorced (D)
    - widowed (W)

    Any more? Re-married, maybe? After collecting all the options, it's time to assess which technique to use. With a lot of options, an IF statement can become quite long and hard to maintain, for example with the Name in A1, the married status in B2, the above options in an IF Statement would be

    =if(B2="Married","M",
       if(B2="Not Married","NM",
          if(B2="Divorced","D",
             if(B2="Widowed","W","Other")
          )
       )
    )
    I've used multiple lines and indentation to draw attention to how the IF statements are nested.

    With so many options, you may as well write a small table on a different sheet with the married status in column A and the abbreviation in column B. Then you can use a simple Vlookup formula to retrieve the abbreviation:

    =vlookup(B2,Sheet2!$A$1:$B:$4,2,false)
    To catch errors, wrap it in IFError

    =iferror(vlookup(B2,Sheet2!$A$1:$B:$4,2,false),"other")
    If you put the lookup table into an Excel object with Insert > table, you can add more rows to the lookup table and the lookup formulas will not need to be changed when new marriage status values are added to the table.

    =VLOOKUP(B2,MarriedStatus[#All],2,FALSE)
    cheers, teylyn

    PS: remember to swap out the commas in the formulas for semicolons if that is what your region uses in Excel.
    Last edited by teylyn; 08-13-2016 at 07:53 PM.

+ 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. Replies: 23
    Last Post: 01-03-2022, 10:45 AM
  2. [SOLVED] VBA and Excel 2016
    By Saturn in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-06-2016, 12:35 PM
  3. Format Cells function not working in excel 2016
    By pongmeister in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-08-2016, 11:58 AM
  4. Replies: 2
    Last Post: 05-24-2016, 10:43 PM
  5. Replies: 4
    Last Post: 03-30-2016, 11:30 AM
  6. [SOLVED] If err.number... gives expected function or variable in Excel 2016
    By BuZZarD73 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-26-2016, 11:18 AM
  7. Excel 2016 & beyond!
    By jewelsharma in forum The Water Cooler
    Replies: 6
    Last Post: 01-10-2016, 05:53 AM

Tags for this Thread

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