+ Reply to Thread
Results 1 to 10 of 10

VLOOKUP for multiple results

Hybrid View

  1. #1
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996
    Hi, Rob

    First: You need the type of formula entered below.
    =SUMPRODUCT(--(A1:A10=$A$1),B1:B10)

    Second: It works by checking the values in one column and adding corresponding values in another column. Those 2 columns need to be listed individually. Consequently, you can't reference a multi-column range (TAB2 or A1:B10).

    Third: If the Tab2 range is on a different sheet, then you'll need to reference that sheet in the formula:
    =SUMPRODUCT(--(Sheet2!A1:A10=$A$1),Sheet2!B1:B10)

    OR

    You could create 2 named ranges on Sheet2 and reference them:
    =SUMPRODUCT(--(Tab2FirstCol=$A$1),Tab2SecondCol)

    Am I helping, yet?

    Ron

  2. #2
    Registered User
    Join Date
    03-08-2005
    Posts
    10
    I'm sure that you are helping, it's just that I'm not the greatest with Excel. I really do appreciate your help though. Right now I'm at home and the spreadsheet is at work. I'll try to wrap my brain around your suggestions and get back with you. Thanks again!

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996
    Ya, know....after looking at your example, the SUMIF function would be the better approach. You'd still need to reference 2 ranges, though. Put this function somewhere on Sheet1 (or whatever sheet Tab1 is on).
    =SUMIF(Sheet2!$A$1:$A$10,A1,Sheet2!$B$1:$B$10)

    That function is the more elegant way to calculate what you want.
    If the Tab2 range is not on Sheet2, replace the Sheet2 reference with the correct sheet name.


    Regards,
    Ron

  4. #4
    Registered User
    Join Date
    03-08-2005
    Posts
    10
    =SUMIF(RPC!$A$1:$A$1927,A1,epay!$F$1:$F$1194)

    This is exactly the formula I tried. It returns 0, but it should be returning $129.30.
    It resides on the RPC tab. Any idea what I'm doing wrong?

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996
    Using your formula:
    =SUMIF(RPC!$A$1:$A$1927,A1,epay!$F$1:$F$1194)


    One issue might be that you are referencing 1927 rows in the lookup column and only 1194 in the conditional column.
    I believe that Excel will implicitly include the same number of rows as the lookup column, but just to be sure:
    Example:
    =SUMIF(RPC!$A$1:$A$1927,A1,epay!$F$1)

    If that isn't the issue, then make sure the values in the conditional column are numbers and not text.

    Does that fix the problem?

    Ron
    Last edited by Ron Coderre; 04-28-2005 at 08:26 PM.

  6. #6
    Registered User
    Join Date
    03-08-2005
    Posts
    10
    Thank you very much for all your help! I modified your formula to work, here it is:

    =IF(VLOOKUP(A2,epay,1)=A2,SUMIF(epay!A:A,A2,epay!F:F),0)

    Thanks again!

    Rob

  7. #7
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996
    I'm glad you figured it out.

    One question, two comments:

    1)By skipping the 4th argument of the VLookup, it defaults to an approximate match....Is that OK?
    IF NO, then you need:
    =IF(VLOOKUP(A2,epay,1,0)=A2,SUMIF(epay!A:A,A2,epay!F :F),0)

    2)Do you have a Sheet AND a Range each named epay? I usually try to avoid that situation.

    3)I'm pretty sure you could cull your formula down to:
    =SUMIF(epay!A:A,A2,epay!F:F)

    Regards,
    Ron

+ 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