+ Reply to Thread
Results 1 to 3 of 3

Help with If, Vlookup, and or Match Function

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    8

    Help with If, Vlookup, and or Match Function

    Hello: For two worksheets: Sheet1 and Sheet2:

    Sheet1:

    Code# Total Cost Charges Incurred
    1 100
    1 200
    1 100
    2 50
    5 50
    5 300

    Sheet2:

    Code# Chargeable?
    1
    2 Yes
    3
    4
    5 Yes
    6 Yes

    If cell A2 (Sheet1) is equal to a value in Column A (Sheet2) [Sheet2!A:A] and there is a corresponding value of "Yes" in cell B2 (Sheet2), then display the value in B2 (Sheet1) in cell C2 (Sheet1).

    Looking for a formula to be copied into Sheet 1, Column C (Charges Incurred):

    I want Excel to see if the "Code" values match on Sheet1 and Sheet2, and Sheet2 also has a value of "Yes" for the corresponding row, then incur the cost in Column C (Sheet1). If it doesn't say "Yes," then put "0."

    In other words, if the Codes match, and there is a value of "Yes" in Column B (Sheet2), then incur the full cost of Column B (Sheet1) in Column C (Sheet1).

    Formulas I tried that did not work:

    "=IF(MATCH(A2, Sheet2!A:A, 0), B2, 0)" This lists everything and does not take into account the constraint to only copy over if the value is "Yes."

    "=IF(VLOOKUP(A2, Sheet2!$A$2:$B$7, 2, 0), C2, 0)" Ironically worked for the cells that did not read "Yes," but it did not work for the values that read "Yes," instead I received the error: "#VALUE!" for the "Yes" cells.

    Sorry for the weird example. I know what I want to do but cannot seem to convey it logically. I work for a pretty backwards company and some of the services we perform are gratis. This formula would help immensely and auto-fill about ~3500 cells for me! Thank you in advance for your help!
    Attached Files Attached Files
    Last edited by jtoscani; 08-30-2012 at 11:19 PM.

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

    Re: Help with If, Vlookup, and or Match Function

    hi jtoscani, welcome to the forum. you almost got it in your VLOOKUP. but i think you should be using B2 instead?
    =IF(VLOOKUP(A2,Sheet2!$A$1:$B$7,2,0)="Yes",B2,0)

    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
    Registered User
    Join Date
    08-30-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Help with If, Vlookup, and or Match Function

    Worked like a charm! Thank you very much for your help!

+ 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