+ Reply to Thread
Results 1 to 5 of 5

Thread: Repeating Variables-VLOOKUP or INDEX/MATCH?

  1. #1
    Registered User
    Join Date
    06-03-2009
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2003
    Posts
    7

    Repeating Variables-VLOOKUP or INDEX/MATCH?

    quick note: What I'm trying to get to isn't as complicated as it looks below (I hope) & is much easier to understand in the attachment.

    Hello! I'm reallllly hoping some one can help. I'm working on a spreadsheet (sample attached). There are 3 variables: Customer code, Account, & Amount. There are multiple customer codes, but only three accounts (each customer code has the same 3 accounts: 1, 2 & 3).
    I get a workbook for each account (but it's just one worksheet for each, so for simplicity here in my Sample it's tabs 1, 2, & 3) and then I create a master worksheet summarizing the data: it shows the totals by account, for each customer code (so 3 rows-1 for each account-per customer code).

    Currently I'm using the following formula, adjusting it by tab for each account:
    =IF(ISERROR(VLOOKUP(A2,'1'!$A$2:$B$8,2,FALSE)),0,VLOOKUP(A2,'1'!$A$2:$B$8,2,FALSE))

    Problems
    Main: Customer codes appear repeatedly in each account tab,as seen in tab 1. The current formula does not pick that up--it only takes the value for the first customer code, when I need the sum of the values for that customer code. So I'm currently manually adding these for the related codes.

    2. this may be difficult, but since I'm already airing my dirty laundry/excel sheets... For a (very few) number of customers, there are two customer codes (two max though, never more) for that customer that should both be included the subtotal (some accounts have both codes, some have only one of the two).
    >In the Sample this is shown in rows 11-15. For Customer "BP" both "BP" and "14"(cell A11) customer codes apply (& in my acutal workbook its displayed the exact same way).
    >In these cases, some accounts have both codes, some have only one or the other (shown in Sample: Account 1 has "14" only, Account 2 has both, Account 3 has "BP" only).

    3. (this may not be relevant--depends on the solution to 1 & 2)
    Customer codes are mainly just 2 letters, but a few are numeric. For the numeric ones, I seem to randomly have trouble getting the formula to work (I've synched the formatting for the master sheet & tabs, tried formatting both as a number, both as text, nothing gives). This is shown in the yellow cell, D9. The formula works in D7 for tab 1, but not in D9 for tab 3.

    What is the best way to approach/solve this? I can't decide if I'm better off using VLOOKUP or an INDEX/MATCH combination (or maybe another alternative?) Many thanks!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2003
    Posts
    270

    Re: Repeating Variables-VLOOKUP or INDEX/MATCH?

    You can use sumif and indirect function to process it.
    See attached.

    Hope this helps,
    windknife
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,006

    Re: Repeating Variables-VLOOKUP or INDEX/MATCH?

    =SUMIF(INDIRECT(B2 & "!A1:A100"),A2,INDIRECT(B2 & "!b1:b100"))

    change the 100 to a reasonable ammount for the data you have

    try to avoid A:A
    Regards
    Darren

    Update 12-Nov-2010 Still job hunting!

    If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.

    Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!


  4. #4
    Registered User
    Join Date
    06-03-2009
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Repeating Variables-VLOOKUP or INDEX/MATCH?

    Thanks! What's the risk/reason to avoid A:A? I had been using it to ensure that any new rows that get added (to the end of the column) are included in the formula.

  5. #5
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,006

    Re: Repeating Variables-VLOOKUP or INDEX/MATCH?

    Quote Originally Posted by jbritt609 View Post
    Thanks! What's the risk/reason to avoid A:A? I had been using it to ensure that any new rows that get added (to the end of the column) are included in the formula.
    that way you dont search 65535 (or 1,000,000 in 2007) rows!
    Regards
    Darren

    Update 12-Nov-2010 Still job hunting!

    If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.

    Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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.2.0