+ Reply to Thread
Results 1 to 14 of 14

Vlookup or if function

  1. #1
    Forum Contributor
    Join Date
    07-22-2008
    Location
    Dhaka, Bangladesh
    MS-Off Ver
    2007
    Posts
    130

    Vlookup or if function

    My Boss set a "criteria" for incentive calculation which is given in H7:U33. He will change the no. of increment given in that area whenever he wants. My job is to give a formula in "D" Column so that it acquire the appropriate value based on criteria. I tried but my formula will be long enough. Let me clarify the criteria

    Incentive depend of designation, job length and grade. For example if designation is General manager and his job length is "8" years and he falls in grade B then in "D3", value will be "6" and so on.

    Can anyone help plz?
    Attached Files Attached Files

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Vlookup or if function

    hi sumonrezadu, i did for just Grade B. i didnt see other grades other than C.

    =INDEX($J$8:$O$33,MATCH($A3,$H$8:$H$33,0),MATCH($B3,{0,5,10,15,20,25},1))

    let me know if you have them

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vlookup or if function

    change the values in j7:o7 to 0 5 10 15 20 25
    then you can use
    =INDEX($J$8:$O$33,MATCH(A3,$H$8:$H$33,0),IF(C3="b",MATCH(B3,$J$7:$O$7,1),MATCH(B3,$J$7:$O$7,1)+6))
    Attached Files Attached Files
    Last edited by martindwilson; 09-26-2012 at 08:14 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Contributor
    Join Date
    07-22-2008
    Location
    Dhaka, Bangladesh
    MS-Off Ver
    2007
    Posts
    130

    Re: Vlookup or if function

    Thanks a lot. Actually I need only grade B and C and no other grade. What is the solution if it falls in grade "C"? My problem is solved for grade B but how can I incorporate grade C also in this formula?
    Pl help

  5. #5
    Forum Contributor
    Join Date
    07-22-2008
    Location
    Dhaka, Bangladesh
    MS-Off Ver
    2007
    Posts
    130

    Re: Vlookup or if function

    Thanks to martindwilson, can it be zero in D3 instead of 6 if C3=0 (i.e if general manager falls in grade C) because Q8=0.
    Ty
    Last edited by sumonrezadu; 09-26-2012 at 07:37 AM.

  6. #6
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Vlookup or if function

    then it can be:
    =INDEX(($J$8:$O$33,$P$8:$U$33),MATCH($A3,$H$8:$H$33,0),MATCH($B3,{0,5,10,15,20,25},1),IF($C3="B",1,2))

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vlookup or if function

    the formula i gave you does b and c

  8. #8
    Forum Contributor
    Join Date
    07-22-2008
    Location
    Dhaka, Bangladesh
    MS-Off Ver
    2007
    Posts
    130

    Re: Vlookup or if function

    Wow that's gr8. I'm really grateful. My prob is solved. But for my learning I cant understand curly bracket "{}". When we use that would u pl make me sense. Thx a lot to benishiryo again
    Last edited by sumonrezadu; 09-26-2012 at 04:43 PM.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vlookup or if function

    {0,5,10,15,20,25} is the same as using values in a range eg $J$7:$O$7 .

  10. #10
    Forum Contributor
    Join Date
    07-22-2008
    Location
    Dhaka, Bangladesh
    MS-Off Ver
    2007
    Posts
    130

    Re: Vlookup or if function

    Yes I understand. Thanks

  11. #11
    Forum Contributor
    Join Date
    07-22-2008
    Location
    Dhaka, Bangladesh
    MS-Off Ver
    2007
    Posts
    130

    Re: Vlookup or if function

    One problem found. there should be 0 value against D or E grade but it is showing value. Value should come against B or C grade only. I cant understand "IF($C3="B",1,2)" this part. Is it if C3=C or D or E, then value would be 2 because it would be 1 only if c3=B.


    Quote Originally Posted by benishiryo View Post
    then it can be:
    =INDEX(($J$8:$O$33,$P$8:$U$33),MATCH($A3,$H$8:$H$33,0),MATCH($B3,{0,5,10,15,20,25},1),IF($C3="B",1,2))

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vlookup or if function

    =if(OR(c3={"e","d"}),0,iNDEX(($J$8:$O$33,$P$8:$U$33),MATCH($A3,$H$8:$H$33,0),MATCH($B3,{0,5,10,15,20,25},1),IF($C3="B",1,2)))

    in the posted solution

    =INDEX(($J$8:$O$33,$P$8:$U$33),MATCH($A3,$H$8:$H$33,0),MATCH($B3,{0,5,10,15,20,25},1),IF($C3="B",1,2))
    this uses the
    INDEX(reference,row_num,column_num,area_num) method of using index
    $J$8:$O$33,$P$8:$U$33 are the 2 areas
    IF($C3="B",1,2) chooses area 1 or 2 so if it isnt "b" it chooses area 2 and returns a value
    Last edited by martindwilson; 09-30-2012 at 08:34 AM.

  13. #13
    Forum Contributor
    Join Date
    07-22-2008
    Location
    Dhaka, Bangladesh
    MS-Off Ver
    2007
    Posts
    130

    Re: Vlookup or if function

    Yes martindwilson, you are right. Actually my problem is solved by you and by benishiryo also. But my Boss is asking me now to include grade "D" also. Duration will be same as grade "B" & "C". Is there any way? Pl held if anyone can


    Quote Originally Posted by martindwilson View Post
    the formula i gave you does b and c

  14. #14
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vlookup or if function

    assuming values for d go in range $V$7:$Z$33 (note there was a typo in =IF(b3="e" should have been =IF(c3="e")
    =IF(C3="e",0,INDEX(($J$8:$O$33,$P$8:$U$33,$V$7:$Z$33),MATCH($A3,$H$8:$H$33,0),MATCH($B3,{0,5,10,15,20,25},1),CODE(UPPER(C3))-65))
    Last edited by martindwilson; 09-30-2012 at 02:29 PM.

+ 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