Consulting

Results 1 to 4 of 4

Thread: Solved: if & vlookup formula : help requried

  1. #1

    Solved: if & vlookup formula : help requried

    Hi

    I have below formula which expected to pick the correspoding values from given reference, this formula works if the cell value has two digits, if cell has single digit, its not working,

    request your help in getting this formula working

    Formulas is as below

    =IF(LEN(D1>1),VLOOKUP(LEFT(D1,1),$A$1:$B$10,2,FALSE)&" and "
    &(VLOOKUP(MID(D1,2,1),$A$1:$B$10,2,FALSE)),(VLOOKUP(LEFT(F1,1),$A$1:$B$10,2 ,FALSE)))

    and other formula

    =IF(LEN(G1<>1),VLOOKUP(LEFT(G1,1),$A$1:$B$10,2,FALSE)&" and "&(VLOOKUP(MID(G1,2,1),$A$1:$B$10,2,FALSE)),(VLOOKUP(LEFT(G1,1),$A$1:$B$10, 2,FALSE)))


    attached is the workbook for your reference
    Attached Files Attached Files

  2. #2
    VBAX Regular
    Joined
    Jul 2012
    Posts
    6
    Location
    Hi,

    For your formula, try

    =IF(LEN(D1>1),VLOOKUP(LEFT(D1,1),$A$1:$B$10,2,FALSE)&" and "
    & (VLOOKUP(MID(D1,1,1),$A$1:$B$10,2,FALSE)),(VLOOKUP(LEFT(F1,1),$A$1:$B$10,2 ,FALSE)))

    In your original formula, the MID function was looking for the second character in a cell which only contained one character.

    Hopefully this should work

    Kevin

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try this

    =VLOOKUP(LEFT(D1,1),$A$1:$B$10,2,FALSE)&IF(LEN(D1)>1," and "&VLOOKUP(MID(D1,2,1),$A$1:$B$10,2,FALSE),"")
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    Hi

    thank you very much for both of you, formula provided by xld is working as expected

    thank you both of you.

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •