Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 17
Default vlookup 2 arguments


I've seen several responses about using match and index to accomplish;
don't see it working for me.

Need to do:
Select Grade from Datablock
where student_id =326 and class=ENG

Datablock could be a 1000 rows. criteria may not be met and return NA.

I've seen some vb code on the net to do this, but my vb is more rusty
than my excel. Is there an Add-in to excel to do this ?

Thank You

MK






  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default vlookup 2 arguments

Select Grade from Datablock

Is Grade a numeric value?

Will there be only one instance of student_id =326 and class=ENG ?

See if this does what you want:

A2:A100 = student_id
B2:B100 = class
C2:C100 = numeric grade

=SUMPRODUCT(--(A2:A100=326),--(B2:B100= "eng"),C2:C100)

Better to use cells to hold the criteria:

E2 = 326
F2 = ENG

=SUMPRODUCT(--(A2:A100=E2),--(B2:B100= F2),C2:C100)

If Grade is a TEXT value...

Array entered** :

=INDEX(C2:C100,MATCH(1,(A2:A100=E2)*(B2:B100=F2),0 ))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"lab-guy" wrote in message
...

I've seen several responses about using match and index to accomplish;
don't see it working for me.

Need to do:
Select Grade from Datablock
where student_id =326 and class=ENG

Datablock could be a 1000 rows. criteria may not be met and return NA.

I've seen some vb code on the net to do this, but my vb is more rusty
than my excel. Is there an Add-in to excel to do this ?

Thank You

MK








  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,510
Default vlookup 2 arguments

You could try using a Helper column and concatenate the 2 values.
Example A2 = 326 and B2 = ENG
in C2 insert = A2&B2 (returns 326ENG)

You can then use Vlookup function on the combined criteria.

--
Regards,

OssieMac


"lab-guy" wrote:


I've seen several responses about using match and index to accomplish;
don't see it working for me.

Need to do:
Select Grade from Datablock
where student_id =326 and class=ENG

Datablock could be a 1000 rows. criteria may not be met and return NA.

I've seen some vb code on the net to do this, but my vb is more rusty
than my excel. Is there an Add-in to excel to do this ?

Thank You

MK






  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default vlookup 2 arguments

Hi,

You can use this array formula (Ctrl+shift+Enter). E10 holds 326 and F10
holds ENG.

=INDEX($E$5:$G$8,MATCH(1,($E$5:$E$8=E10)*($F$5:$F$ 8=F10),0),3)

This will work for both numeric or non-numeric grades

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"lab-guy" wrote in message
...

I've seen several responses about using match and index to accomplish;
don't see it working for me.

Need to do:
Select Grade from Datablock
where student_id =326 and class=ENG

Datablock could be a 1000 rows. criteria may not be met and return NA.

I've seen some vb code on the net to do this, but my vb is more rusty
than my excel. Is there an Add-in to excel to do this ?

Thank You

MK






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 857
Default vlookup 2 arguments

Hi,

In 2007 it could be done with

=SUMIFS(C1:C1000,A1:A1000,326,B1:B1000,"Eng")

where D1 is 326 and D2 is Eng.

or in 2003, here is another solution:

=SUMPRODUCT(A1:A1000&B1:B1000=D1,C1:C1000)

where D1 is 326Eng

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"lab-guy" wrote:


I've seen several responses about using match and index to accomplish;
don't see it working for me.

Need to do:
Select Grade from Datablock
where student_id =326 and class=ENG

Datablock could be a 1000 rows. criteria may not be met and return NA.

I've seen some vb code on the net to do this, but my vb is more rusty
than my excel. Is there an Add-in to excel to do this ?

Thank You

MK






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
VLOOKUP (Using Multiple Arguments) Ryan F[_2_] Excel Worksheet Functions 1 January 20th 09 06:31 PM
How many rows (arguments?) can be seached by Vlookup function? Ross Excel Discussion (Misc queries) 4 October 14th 08 04:39 AM
2 way Vlookup - Creating array arguments from columns Hari Excel Discussion (Misc queries) 1 May 11th 06 01:18 PM
Multiple vlookup arguments ichall Excel Worksheet Functions 2 October 19th 05 10:47 PM
Too many arguments-VLOOKUP instead? Trina` Excel Worksheet Functions 2 July 4th 05 10:13 AM


All times are GMT +1. The time now is 04:30 PM.

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

About Us

"It's about Microsoft Excel"