Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...An excellent site which has quite possibly prevented me from having a mental/nervous breakdown..."

Geography

Where in the world do Tek-Tips members come from?

Matching Two Columns From One Worksheet to Two Columns in Another While Returning a Value

PeanutB7 (Programmer)
16 May 12 12:40

I am working with one Spreadsheet that contains two worksheets. I am attempting to match two columns in spreadsheet one to two columns in spreadsheet two. A respective number would then be inserted as the output from Column C

Spreadsheet 1
Column A Column B
Location Item Number

Spreadsheet 2
Column A Column B Column C
Location Item Number Activity Qty


I have tried a few formulas but no success.

=SUMPRODUCT(--($A$2:$A$2500='Spreadsheet 2'!$A$2:$A$2500), (--$B$2:$B$2500='Spreadsheet 2'!$B$2:$B$2500), --('Spreadsheet 2'!C2))

Any help would be GREATLY appreciated.

Thanks in advance,

J
Gruuuu (Programmer)
16 May 12 13:24
Just use a helper column off to the side. Concatenate your lookup column values together (like so)

=A2&"|"&B2

(I always put a pipe in as a separator. You don't have to use a pipe, but you should definitely use something)

Then when you do your lookup, concatenate your lookup_value (like so):

=VLOOKUP(A2&"|"&B2,Sheet1!$A$1:$D$5000,4,false)


If you choose to do this, you would need to put your helper column in column A, because of the particularly annoying limitation of VLOOKUP that your lookup index must be to the left of your desired value.

If you wish to avoid that limitation, you would need to use INDEX/MATCH, which is gone into some detail here
SkipVought (Programmer)
16 May 12 13:51

This does not make sense as a lookup!

So you do a lookup -- Then what?

What you supposedly tried via SUMPRODUCT() is not a lookup, but an aggregation.

Suppose you tell us WHAT it is that you need to do, rather than HOW you think it ought to be achieved.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Gruuuu (Programmer)
16 May 12 14:40
Oh wait, I believe I've misunderstood the question. PeanutB7, do you just want a count of occurring combinations of Location and Item Number?
PeanutB7 (Programmer)
16 May 12 15:19
Folks

Thanks for the help.

Worksheet 1 contains a Column A for location and Column B for a product item number (i.e., SKU). Worksheet 2 has the same two columns as well as an activity quantity Column C showing how many of the item numbers have been used in each location. I would like to match each row of worksheet 1 in respect to the location and item number with the corresponding location and item number in worksheet 2. I would then like to transfer the value in worksheet 2 into worksheet 1 based on the match of Column A & B in each specific row. We are trying to review par levels of inventory (from Worksheet 1) in each location based on the activity that is indicated in worksheet 2. Based on some research online I came up with the SUMPRODUCT formula but that may not be best formula to use.

Worksheet 1
Column A Column B Column C
Location Item Number Activity Qty
Pittsburgh 325-11-2222 16 (Value determined by formula looking in worksheet 2)
Cleveland 325-11-2222 12 (Value determined by formula looking in worksheet 2)


Worksheet 2
Column A Column B Column C
Location Item Number Activity Qty
Cleveland 325-11-2222 12
Pittsburgh 325-11-1111 10
Pittsburgh 325-11-2222 16
Toledo 325-22-1234 18

Again I appreciate the assistance and hope I have provided enough information to help.

Thank you kindly,

J
SkipVought (Programmer)
16 May 12 16:03
paste in C2 and copy/paste down...

=SUMPRODUCT((A2='Spreadsheet 2'!$A$2:$A$2500)*(B2='Spreadsheet 2'!$B$2:$B$2500)*('Spreadsheet 2'!$C$2:$C$2500))


Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

PeanutB7 (Programmer)
17 May 12 9:12
Is there anyone that can provide advise on this formula?

Thank you and have great day,

J
PeanutB7 (Programmer)
17 May 12 9:14
Sorry Skip - I did not see your earlier post.

Thank you very kindly,

J
SkipVought (Programmer)
17 May 12 9:15
P, it is VERY puzzeling, as your question is so ambiguous.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

SkipVought (Programmer)
17 May 12 9:24
BTW, the SUMPRODUCT() function as posted, is an aggregation. So I there is more than one row occurrence of the column A/column B pair in Worksheet 2, the column C values will be SUMMED.

Secondly, it is a poor practice to have a table of data without column headings. Excel is designed to work with TABLES.

FAQ68-5184: What are LIST & TABLE PRINCIPLES for Spreadsheet Users

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close