+ Reply to Thread
Results 1 to 3 of 3

VLOOKUP VBA with IF clause

  1. #1
    Registered User
    Join Date
    05-23-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    42

    Question VLOOKUP VBA with IF clause

    Hello excel geniuses,

    I am relatively new to VBA but understand its functionality. I am currently trying to build a Business Card Request Form and I need to create a VLOOKUP vba.

    The function looks like this: =VLOOKUP(B2, NameLookup,2,0)

    Furthermore, I wanted to know if I could make an IF clause that would make the cell appear blank if nothing is pulled form the VLOOKUP. The blank cell would then be manualy entered with the correct data.

    Can anyone help me with this?

    Thank You,
    Sajan

  2. #2
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: VLOOKUP VBA with IF clause

    sure, pretty easy, vlookup will return #N/A if there is nothing found which is considered an error, the iferror looks to see if the value retruned is an error and if it is then the "" (blank) will be the result, otherwise if it is not an error then it will be the vlookup
    =iferror(VLOOKUP(B2, NameLookup,2,0),"")

  3. #3
    Registered User
    Join Date
    05-23-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: VLOOKUP VBA with IF clause

    Thanks for the help Scott!

    My only question is that if I enter this formula into the cell, when a user deletes the contents of the cell, the forumla goes away. They will manually enter data with Vlookup does not return any value, so the formula will be deleted.

    Do you know how I can keep the forumal there, so that the user can still enter data into this cell when it appears blank?

+ 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