Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Lookup data in 2 columns

Example:

C1 C2 C3
R1 Apple Fuji 10

I want to create a lookup that will return the value 10 if C1=Apple AND
C2=Fuji.
Can someone help? Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default Lookup data in 2 columns

Create a helper column with Apple and fuji concatenated together. Then do
the lookup (or index) based upon that.

"Sweepea" wrote:

Example:

C1 C2 C3
R1 Apple Fuji 10

I want to create a lookup that will return the value 10 if C1=Apple AND
C2=Fuji.
Can someone help? Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Lookup data in 2 columns

Is there other options without going the concatenate route? The problem is I
can't really
change the data, can only do a lookup to read the data.

Please advise.


"Barb Reinhardt" wrote:

Create a helper column with Apple and fuji concatenated together. Then do
the lookup (or index) based upon that.

"Sweepea" wrote:

Example:

C1 C2 C3
R1 Apple Fuji 10

I want to create a lookup that will return the value 10 if C1=Apple AND
C2=Fuji.
Can someone help? Thank you.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Lookup data in 2 columns

Saved from a previous post:

If you want exact matches for just two columns (and return a value from a
third), you could use:

=index(othersheet!$c$1:$c$100,
match(1,(a2=othersheet!$a$1:$a$100)*(b2=othersheet !$b$1:$b$100),0))

(all in one cell)

This is an array formula. Hit ctrl-shift-enter instead of enter. If you do it
correctly, excel will wrap curly brackets {} around your formula. (don't type
them yourself.)

Adjust the range to match--but you can't use the whole column.

This returns the value in othersheet column C when column A and B (of
othersheet) match A2 and B2 of the sheet with the formula.

And you can add more conditions by just adding more stuff to that product
portion of the formula:

=index(othersheet!$d$1:$d$100,
match(1,(a2=othersheet!$a$1:$a$100)
*(b2=othersheet!$b$1:$b$100)
*(c2=othersheet!$c$1:$c$100),0))

Sweepea wrote:

Example:

C1 C2 C3
R1 Apple Fuji 10

I want to create a lookup that will return the value 10 if C1=Apple AND
C2=Fuji.
Can someone help? Thank you.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default Lookup data in 2 columns

Hi,

A possibility using sumproduct:

=SUMPRODUCT(--(A1:A1="Apple"),--(B1:B1="Fuji"),C1:C1)

The range can be extended e.g. A1:A100, B1:B100, C1:C100 etc.

Hth
Anthony

"Sweepea" wrote:

Example:

C1 C2 C3
R1 Apple Fuji 10

I want to create a lookup that will return the value 10 if C1=Apple AND
C2=Fuji.
Can someone help? Thank you.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Lookup data in 2 columns

Thank you, Anthony. The formula is easy and it really helps.

But I will try Dave's method as well.

Thanks everyone for your help .... most sincerely appreciated.


"Anthony D" wrote:

Hi,

A possibility using sumproduct:

=SUMPRODUCT(--(A1:A1="Apple"),--(B1:B1="Fuji"),C1:C1)

The range can be extended e.g. A1:A100, B1:B100, C1:C100 etc.

Hth
Anthony

"Sweepea" wrote:

Example:

C1 C2 C3
R1 Apple Fuji 10

I want to create a lookup that will return the value 10 if C1=Apple AND
C2=Fuji.
Can someone help? Thank you.

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Lookup data in 2 columns

Anthony's formula is a very nice way to sum the values in column C when column A
and column B match the criteria (apple/fuji).

The other formula is more like an =vlookup(). It will return text or number for
the first row that matches the criteria.

Sweepea wrote:

Thank you, Anthony. The formula is easy and it really helps.

But I will try Dave's method as well.

Thanks everyone for your help .... most sincerely appreciated.

"Anthony D" wrote:

Hi,

A possibility using sumproduct:

=SUMPRODUCT(--(A1:A1="Apple"),--(B1:B1="Fuji"),C1:C1)

The range can be extended e.g. A1:A100, B1:B100, C1:C100 etc.

Hth
Anthony

"Sweepea" wrote:

Example:

C1 C2 C3
R1 Apple Fuji 10

I want to create a lookup that will return the value 10 if C1=Apple AND
C2=Fuji.
Can someone help? Thank you.


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default Lookup data in 2 columns

You are very welcome, Sweepea, thank you for your feedback.

One additional consideration. As Dave notes, this currently assumes the
criteria are met. If the value in column C for a valid combination like Apple
and Fuji could be 0, there would be no distinction between not finding the
combination (e.g. through inaccurate search critera or data) and finding it,
both giving 0 in that particular case. The expression can be extended to
cover this by verifying the existence of the search criteria in the data.

Anthony

"Sweepea" wrote:

Thank you, Anthony. The formula is easy and it really helps.

But I will try Dave's method as well.

Thanks everyone for your help .... most sincerely appreciated.


"Anthony D" wrote:

Hi,

A possibility using sumproduct:

=SUMPRODUCT(--(A1:A1="Apple"),--(B1:B1="Fuji"),C1:C1)

The range can be extended e.g. A1:A100, B1:B100, C1:C100 etc.

Hth
Anthony

"Sweepea" wrote:

Example:

C1 C2 C3
R1 Apple Fuji 10

I want to create a lookup that will return the value 10 if C1=Apple AND
C2=Fuji.
Can someone help? Thank you.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting 2 colums of numbers and incremening them down blk&wht Excel Discussion (Misc queries) 10 October 9th 06 10:12 PM
summing columns if there is data Dave Excel Worksheet Functions 2 June 22nd 06 08:04 PM
Data in narrow columns truncated when saving as DBF Ben Amada Excel Discussion (Misc queries) 2 October 11th 05 11:23 PM
Sort pages? David Excel Discussion (Misc queries) 15 May 13th 05 11:33 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM


All times are GMT +1. The time now is 08:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"