+ Reply to Thread
Results 1 to 7 of 7

Slight different case of multiple condition with regard to if

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Slight different case of multiple condition with regard to if

    I tried to develop a formula that has the following condition,

    If K1 = 1 then result must be ""
    If K1 = 2 then result must be 6
    If K1 = 3 then result must be 43
    If K1 = 4 then result must be J4+6
    If K1 = 5 then result must be J4+6
    If K1 = 6 then result must be J4+6
    If K1 = 7 then result must be J4+6

    Can anyone help in this regard

  2. #2
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Re: Slight different case of multiple condition with regard to if

    Try this..

    =IF(K1=1,"",(IF(K1=2,6,(IF(K1=3,43,(IF(K1=4,J4+6,(IF(K1=5,J4+6,(IF(K1=6,J4+6,IF(K1=7,J4+6,"NA"))))))))))))

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,040

    Re: Slight different case of multiple condition with regard to if

    Here:
    Formula: copy to clipboard
    =CHOOSE(MIN(4,K1),"",6,43,J4+6)
    Never use Merged Cells in Excel

  4. #4
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Re: Slight different case of multiple condition with regard to if

    Thanx Zbor,

    Can you elaborate your formula in details.Your formula is so short and very sweet.Also how would you revise your formula in case,

    If K1 = 1 then result must be ""
    If K1 = 2 then result must be 38
    If K1 = 3 then result must be 43
    If K1 = 4 then result must be ""
    If K1 = 5 then result must be ""
    If K1 = 6 then result must be ""
    If K1 = 7 then result must be ""

    I have used accordingly as
    =CHOOSE(MIN(4,K1),"",38,43,"")
    Kindly explain your formula as well as below formula is correct or not,that I have made similarly like yours,if any mistake kindly modify accordingly .

    I marking this thread as solved.Thanx to "Elayaz" too.

    With Best Rgds

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,040

    Re: Slight different case of multiple condition with regard to if

    You wrote correct.

    CHOOSE function return n-th value defined by index number.
    Formula: copy to clipboard
    CHOOSE(index_num,value1,value2,value3...)


    If index_num is 1, CHOOSE returns value1; if it is 2, CHOOSE returns value2; and so on.

    In your case you need to return:,"",38,43,"" wehre index_num is defined by value in K1 (1,2,3 or 4)
    If K1 is bigger than 4 you will get error (because 5th value in CHOOSE function is not defined).
    But since they are all same after 4th value you can use always that value (4) so you need
    Formula: copy to clipboard
    MIN(4,K1)


    That will return 1,2,3 or 4
    MIN(4,1)	1
    MIN(4,2)	2
    MIN(4,3)	3
    MIN(4,4)	4
    MIN(4,5)	4
    MIN(4,6)	4
    If this not the case, if values after 4 are different, then you need to define all of them in CHOOSE function.
    That would make CHOOSE function too huge and I would rather go with VLOOKUP function in that case (but that's another sotry).

    At the end, let's sumarize once again:
    Index_num 3 will return 3rd value in your choose function that is 43

    Formula: copy to clipboard

    =CHOOSE(index_num,value1,value2,value3...)
    =CHOOSE(3,"",38,43,"")
    Last edited by zbor; 04-29-2014 at 04:43 AM.

  6. #6
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Slight different case of multiple condition with regard to if

    Another way..
    =IF(K1>=4,J4+6,INDEX({"",6,43},K1))

    answer to your second question would be
    =INDEX({"",38,43,""},MIN(K1,4))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  7. #7
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Re: Slight different case of multiple condition with regard to if

    Thanks all of the forum contributors.Indeed,this had minimised my work.

+ 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] if condition in multi case.....
    By amarjeet.it in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-07-2017, 03:12 AM
  2. Search function for multiple terms with a slight twist
    By sjb123 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-24-2012, 06:48 AM
  3. Need to set second condition to Case
    By BuzzT in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-18-2011, 03:36 PM
  4. Select case with AND condition
    By singhabhijitkumar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2010, 10:32 PM
  5. Select Case Condition Not Being Met
    By chergh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2008, 10:06 AM

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