+ Reply to Thread
Results 1 to 16 of 16

Correcting an If statement to allow for my than 7 nested If's

  1. #1
    Registered User
    Join Date
    06-03-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    19

    Unhappy Correcting an If statement to allow for my than 7 nested If's

    Hello,

    is there any shortcut for this formula?
    its hard to memorize.
    =IF(d2=28,"ALB",IF(d2=22,"LIB",IF(d2=25,"SHW",IF(d2=35,"CLK",IF(d2=40,"CB1",IF(d2=48,"CB2",IF(d2=3,"MAK","")))))))PLs help me.

    ANY help is deeply appreciated. Thank you so much guys
    Last edited by mozak; 06-12-2011 at 11:06 PM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Excel 2016
    Posts
    10,094

    Re: ANY shortcut for this long "IF function",

    People are here to help?

    Please revise your thread title to something more appropriate.

    Take a look at the Lookup function in Excel help.
    Last edited by jeffreybrown; 06-11-2011 at 10:42 PM.
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    06-03-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: ANY shortcut for this long "IF function",

    thank you sir .. title has been revise,, im sorry for not being polite

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Excel 2016
    Posts
    10,094

    Re: [HELP]"IF function" is too long. is their another way on writing it? pls help me

    Did you see the forum rules?

    1. Use concise, accurate thread titles. Your post title should describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change the title of the thread, click EDIT on the original post, then click the Go Advanced button, then change the title. If two or more hours have passed, the EDIT button will not appear, and you need to ask a moderator to change the title.

    How about a title like, Correcting an If statement to allow for my than 7 nested If's (and without the word help). Did you look at the Excel help under the Lookup function. Create a Lookup table in ascending order and then use =LOOKUP(D2,I1:J7)
    Last edited by jeffreybrown; 06-11-2011 at 10:53 PM.

  5. #5
    Registered User
    Join Date
    06-03-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: [HELP]"IF function" is too long. is their another way on writing it? pls help me

    Hey Sir Title benn change and no one answers my post.. how about that sir,

    what is the use of this forum if you only check what is necessary and do not answer my post,

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,406

    Re: Correcting an If statement to allow for my than 7 nested If's

    Look here...

    You need to define some table with your values (yellow box in example) and then you can add in yellow box as many values you want.

    There are two approach like in example.

    One with : =VLOOKUP($D$2;$L$15:$M$33;2;FALSE)
    Second: =VLOOKUP($D$3;$L$15:$M$33;2;TRUE)

    Difference is if you enter some value that is not in the list (for example 29).

    First will return you error, second will return you first value below (ALB).
    But for that your values must be sorted in ascending order.

    If you enter number from a list (i.e. 28) both will return same coresponding value (ALB)

    Hope this helped.
    Attached Files Attached Files

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,324

    Re: Correcting an If statement to allow for my than 7 nested If's

    mozak
    or possibly

    =IFERROR(INDEX({"M AK","LIB","SHW","ALB","CLK","CB1","CB2"},MATCH(D2,{3,22,25,28,35,40,48},0)),"")

    And yes; in this forum you need to comply to the rules you agree to before your threads are answer.

  8. #8
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: Correcting an If statement to allow for my than 7 nested If's

    Hi

    Take a look at the attached workbook.
    I have placed all your values on Sheet 2, and then used a Vlookup formula
    =IF(D2="","",VLOOKUP(D2,Sheet2!A:B,2,0))
    Attached Files Attached Files
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,406

    Re: Correcting an If statement to allow for my than 7 nested If's

    It's the same solution I've posted half hour ago...

    So I guess, except pike, noone reads my solutions anymore

  10. #10
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,324

    Re: Correcting an If statement to allow for my than 7 nested If's

    i did read that one about BBQ's

  11. #11
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,406

    Re: Correcting an If statement to allow for my than 7 nested If's

    That's something too

  12. #12
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: Correcting an If statement to allow for my than 7 nested If's

    Quote Originally Posted by zbor View Post
    It's the same solution I've posted half hour ago...

    So I guess, except pike, noone reads my solutions anymore
    Hi
    If you are referring to my posting, then nothing was showing up on my machine after the last post by the OP, complaining nobody was answering.

    After posting my answer, the other postings showed up.
    I guess refreshing was not working correctly when I had clicked on NewPosts.

  13. #13
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,406

    Re: Correcting an If statement to allow for my than 7 nested If's

    It's OK.. happens to me all the time

    Edit: Espetially when I lose half hour for some complicated result and then I saw some nice and simple solution

  14. #14
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,324

    Re: Correcting an If statement to allow for my than 7 nested If's

    yep, guessed thats what happened..happens all the time.

  15. #15
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,218

    Re: Correcting an If statement to allow for my than 7 nested If's

    And hey! I'm busy answering the same thing in this thread
    [HELP] Changing the content of column E to C
    See post #3

    @ pike IFERROR in 2003?
    Last edited by Marcol; 06-12-2011 at 05:45 AM.

  16. #16
    Registered User
    Join Date
    06-03-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Correcting an If statement to allow for my than 7 nested If's

    Quote Originally Posted by Marcol View Post
    And hey! I'm busy answering the same thing in this thread
    [HELP] Changing the content of column E to C
    See post #3

    @ pike IFERROR in 2003?
    HI thanks for this one,,, you totally got it...

    thank you

+ 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