+ Reply to Thread
Results 1 to 1 of 1

VBA Code Using IF and VLOOKUP Function

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    1

    VBA Code Using IF and VLOOKUP Function

    Hi all

    I've only just discovered VBA yesterday so go easy on me. Basically I have a spreadsheet which has validation list in column B, C and E. Column B is a list of Trade types, column C is a list with option 'Labour' or 'Material'. I currently have coding set up to auto populate column E, where if column C is 'Labour', the validation list in column E on the same row prefills to say 'HR', otherwise it remains blank until one of the other three values are selected.

    What I would now like to do is use a formula such as =IF(C5="Labour",VLOOKUP($B5,$A$112:$B$145,2,FALSE),0) to say if column C is 'Labour', it uses a vlookup to also auto populate an hourly rate in column F for that Trade type selected in Column B, using a table. This is in addition to the Rate in Column E auto populating.

    I do not want to just use a formula for this, as I want the cells in the hourly rate column F to remain blank so that you can still freetype into the cells within losing the formula should the Rate type not be HR.

    Sheet attached.

    Any help would be great! I have found other posts re VBA and vlookup, but nothing with IF that I can copy straight off.
    Attached Files Attached Files

+ 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