ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   MATCH function in a VLOOKUP (https://www.excelbanter.com/excel-worksheet-functions/112570-match-function-vlookup.html)

trevor_tito

MATCH function in a VLOOKUP
 
Hi,

I am trying to determine the column index number in a vlookup with a matcxh
function but I'm getting an #N/A error message.

The table I am looking up may change in shape (e.g. not always the same
number of rows or columns) so I have given this a name range.

The table (called NAME_RANGE) is basically

ZZ YY XX
A 10 40 70
B 20 50 80
C 30 60 90
TOTAL 60 150 240

The formula I am using is more or less:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",NAME_RANGE) ,FALSE)

I should get 150.

What have I done wrong?

Cheers
TT


Epinn

MATCH function in a VLOOKUP
 
Regarding the MATCH function, do you want match_type to be 0 or FALSE i.e. exact match? How is the table sorted?

************************************************** **************************************
Following from Excel Help:-

If match_type is omitted, it is assumed to be 1.
If match_type is 1, MATCH finds the largest value that is less than or equal to lookup_value. Lookup_array must be placed in ascending order.

If MATCH is unsuccessful in finding a match, it returns the #N/A error value.
************************************************** **************************************
Have you tried to use evaluate formula to watch the steps unfold?
Interesting formula. I'll go and explore some more now while we wait for the experts' advice.

Epinn

"trevor_tito" wrote in message ...
Hi,

I am trying to determine the column index number in a vlookup with a matcxh
function but I'm getting an #N/A error message.

The table I am looking up may change in shape (e.g. not always the same
number of rows or columns) so I have given this a name range.

The table (called NAME_RANGE) is basically

ZZ YY XX
A 10 40 70
B 20 50 80
C 30 60 90
TOTAL 60 150 240

The formula I am using is more or less:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",NAME_RANGE) ,FALSE)

I should get 150.

What have I done wrong?

Cheers
TT



Biff

MATCH function in a VLOOKUP
 
Is NAME_RANGE a dynamic range?

Try this:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",INDEX(NAME_ RANGE,1,),0),FALSE)

Biff

"trevor_tito" wrote in message
...
Hi,

I am trying to determine the column index number in a vlookup with a
matcxh
function but I'm getting an #N/A error message.

The table I am looking up may change in shape (e.g. not always the same
number of rows or columns) so I have given this a name range.

The table (called NAME_RANGE) is basically

ZZ YY XX
A 10 40 70
B 20 50 80
C 30 60 90
TOTAL 60 150 240

The formula I am using is more or less:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",NAME_RANGE) ,FALSE)

I should get 150.

What have I done wrong?

Cheers
TT




Epinn

MATCH function in a VLOOKUP
 
TT,

Forgive me for borrowing the space of your thread. I want to ask Biff something. Forgive me for thinking aloud too. Bad habit.

Biff,

I had a feeling that MATCH ( ) in the formula was the culprit so I pulled it out and explored it.

I was able to achieve getting #N/A quite a few times. One case is not specifying "0" or "FALSE" which I suggested in my previous post.

Is it true that the argument for MATCH ( ) can either be a *single* column or a *single* row only? We can't use an array A1:D5 (Name_range), right? It gave me #N/A even when I tried to use CSE. ;) I suspected MATCH and Name_range together was the problem in the formula but I didn't know how to fix it although INDEX ( ) did pop up. Next time, I'll know.

Look forward to your guidance. I really like to know about the single column/row.

Epinn

"Biff" wrote in message ...
Is NAME_RANGE a dynamic range?

Try this:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",INDEX(NAME_ RANGE,1,),0),FALSE)

Biff

"trevor_tito" wrote in message
...
Hi,

I am trying to determine the column index number in a vlookup with a
matcxh
function but I'm getting an #N/A error message.

The table I am looking up may change in shape (e.g. not always the same
number of rows or columns) so I have given this a name range.

The table (called NAME_RANGE) is basically

ZZ YY XX
A 10 40 70
B 20 50 80
C 30 60 90
TOTAL 60 150 240

The formula I am using is more or less:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",NAME_RANGE) ,FALSE)

I should get 150.

What have I done wrong?

Cheers
TT





Roger Govier

MATCH function in a VLOOKUP
 
Hi Trevor

I would be inclined to use Index Match for my result, rather than a mix
of Vlookup and Match
Regardless of the shape of your table, if the top left corner is always
A1 then
=INDEX(NAME_RANGE,MATCH("Total",A:A,0),MATCH("YY", (1:1),0))

If your NAME_RANGE does not always start in A1, then I would have 2
other named ranges,
Myrow which defined the row with the headings (e.g. $7:$7),
and Mycol which defined the column with the names and Total (e.g. $C:$C)
Then
=INDEX(NAME_RANGE,MATCH("Total",Mycol,0),MATCH("YY ",Myrow,0))

--
Regards

Roger Govier


"trevor_tito" wrote in message
...
Hi,

I am trying to determine the column index number in a vlookup with a
matcxh
function but I'm getting an #N/A error message.

The table I am looking up may change in shape (e.g. not always the
same
number of rows or columns) so I have given this a name range.

The table (called NAME_RANGE) is basically

ZZ YY XX
A 10 40 70
B 20 50 80
C 30 60 90
TOTAL 60 150 240

The formula I am using is more or less:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",NAME_RANGE) ,FALSE)

I should get 150.

What have I done wrong?

Cheers
TT




Ponty'NPop

MATCH function in a VLOOKUP
 
Hi Trevor,

Perhaps,

Name the cell TotalYY and reference that name thereafter?

HTH,
--
Kevin James.
Tua'r Goleuni


"trevor_tito" wrote in message
...
| Hi,
|
| I am trying to determine the column index number in a vlookup with a matcxh
| function but I'm getting an #N/A error message.
|
| The table I am looking up may change in shape (e.g. not always the same
| number of rows or columns) so I have given this a name range.
|
| The table (called NAME_RANGE) is basically
|
| ZZ YY XX
| A 10 40 70
| B 20 50 80
| C 30 60 90
| TOTAL 60 150 240
|
| The formula I am using is more or less:
|
| =VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",NAME_RANGE) ,FALSE)
|
| I should get 150.
|
| What have I done wrong?
|
| Cheers
| TT
|



Teethless mama

MATCH function in a VLOOKUP
 
=INDEX(NAME_RANGE,MATCH("TOTAL",A1:A5,0),MATCH("YY ",A1:D1,0))


"trevor_tito" wrote:

Hi,

I am trying to determine the column index number in a vlookup with a matcxh
function but I'm getting an #N/A error message.

The table I am looking up may change in shape (e.g. not always the same
number of rows or columns) so I have given this a name range.

The table (called NAME_RANGE) is basically

ZZ YY XX
A 10 40 70
B 20 50 80
C 30 60 90
TOTAL 60 150 240

The formula I am using is more or less:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",NAME_RANGE) ,FALSE)

I should get 150.

What have I done wrong?

Cheers
TT


Roger Govier

MATCH function in a VLOOKUP
 
Hi Kevin

Tua'r Goleuni

Were you at Cardiff High School?

--
Regards

Roger Govier


"Ponty'NPop" wrote in message
...
Hi Trevor,

Perhaps,

Name the cell TotalYY and reference that name thereafter?

HTH,
--
Kevin James.
Tua'r Goleuni


"trevor_tito" wrote in message
...
| Hi,
|
| I am trying to determine the column index number in a vlookup with a
matcxh
| function but I'm getting an #N/A error message.
|
| The table I am looking up may change in shape (e.g. not always the
same
| number of rows or columns) so I have given this a name range.
|
| The table (called NAME_RANGE) is basically
|
| ZZ YY XX
| A 10 40 70
| B 20 50 80
| C 30 60 90
| TOTAL 60 150 240
|
| The formula I am using is more or less:
|
| =VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",NAME_RANGE) ,FALSE)
|
| I should get 150.
|
| What have I done wrong?
|
| Cheers
| TT
|





Biff

MATCH function in a VLOOKUP
 
can either be a *single* column or a *single* row only?
We can't use an array A1:D5 (Name_range), right?


That is correct. Match only works on one dimensional arrays.

Biff

"Epinn" wrote in message
...
TT,

Forgive me for borrowing the space of your thread. I want to ask Biff
something. Forgive me for thinking aloud too. Bad habit.

Biff,

I had a feeling that MATCH ( ) in the formula was the culprit so I pulled it
out and explored it.

I was able to achieve getting #N/A quite a few times. One case is not
specifying "0" or "FALSE" which I suggested in my previous post.

Is it true that the argument for MATCH ( ) can either be a *single* column
or a *single* row only? We can't use an array A1:D5 (Name_range), right?
It gave me #N/A even when I tried to use CSE. ;) I suspected MATCH and
Name_range together was the problem in the formula but I didn't know how to
fix it although INDEX ( ) did pop up. Next time, I'll know.

Look forward to your guidance. I really like to know about the single
column/row.

Epinn

"Biff" wrote in message
...
Is NAME_RANGE a dynamic range?

Try this:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",INDEX(NAME_ RANGE,1,),0),FALSE)

Biff

"trevor_tito" wrote in message
...
Hi,

I am trying to determine the column index number in a vlookup with a
matcxh
function but I'm getting an #N/A error message.

The table I am looking up may change in shape (e.g. not always the same
number of rows or columns) so I have given this a name range.

The table (called NAME_RANGE) is basically

ZZ YY XX
A 10 40 70
B 20 50 80
C 30 60 90
TOTAL 60 150 240

The formula I am using is more or less:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",NAME_RANGE) ,FALSE)

I should get 150.

What have I done wrong?

Cheers
TT






trevor_tito

MATCH function in a VLOOKUP
 
Thanks Roger,

That worked a treat. I will need to name range the row and column headers.

Cheers.
TT

"Roger Govier" wrote:

Hi Trevor

I would be inclined to use Index Match for my result, rather than a mix
of Vlookup and Match
Regardless of the shape of your table, if the top left corner is always
A1 then
=INDEX(NAME_RANGE,MATCH("Total",A:A,0),MATCH("YY", (1:1),0))

If your NAME_RANGE does not always start in A1, then I would have 2
other named ranges,
Myrow which defined the row with the headings (e.g. $7:$7),
and Mycol which defined the column with the names and Total (e.g. $C:$C)
Then
=INDEX(NAME_RANGE,MATCH("Total",Mycol,0),MATCH("YY ",Myrow,0))

--
Regards

Roger Govier


"trevor_tito" wrote in message
...
Hi,

I am trying to determine the column index number in a vlookup with a
matcxh
function but I'm getting an #N/A error message.

The table I am looking up may change in shape (e.g. not always the
same
number of rows or columns) so I have given this a name range.

The table (called NAME_RANGE) is basically

ZZ YY XX
A 10 40 70
B 20 50 80
C 30 60 90
TOTAL 60 150 240

The formula I am using is more or less:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",NAME_RANGE) ,FALSE)

I should get 150.

What have I done wrong?

Cheers
TT





Epinn

MATCH function in a VLOOKUP
 
Biff,

Thanks for answering my various questions. Appreciate it.

Epinn

"Biff" wrote in message ...
can either be a *single* column or a *single* row only?
We can't use an array A1:D5 (Name_range), right?


That is correct. Match only works on one dimensional arrays.

Biff

"Epinn" wrote in message
...
TT,

Forgive me for borrowing the space of your thread. I want to ask Biff
something. Forgive me for thinking aloud too. Bad habit.

Biff,

I had a feeling that MATCH ( ) in the formula was the culprit so I pulled it
out and explored it.

I was able to achieve getting #N/A quite a few times. One case is not
specifying "0" or "FALSE" which I suggested in my previous post.

Is it true that the argument for MATCH ( ) can either be a *single* column
or a *single* row only? We can't use an array A1:D5 (Name_range), right?
It gave me #N/A even when I tried to use CSE. ;) I suspected MATCH and
Name_range together was the problem in the formula but I didn't know how to
fix it although INDEX ( ) did pop up. Next time, I'll know.

Look forward to your guidance. I really like to know about the single
column/row.

Epinn

"Biff" wrote in message
...
Is NAME_RANGE a dynamic range?

Try this:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",INDEX(NAME_ RANGE,1,),0),FALSE)

Biff

"trevor_tito" wrote in message
...
Hi,

I am trying to determine the column index number in a vlookup with a
matcxh
function but I'm getting an #N/A error message.

The table I am looking up may change in shape (e.g. not always the same
number of rows or columns) so I have given this a name range.

The table (called NAME_RANGE) is basically

ZZ YY XX
A 10 40 70
B 20 50 80
C 30 60 90
TOTAL 60 150 240

The formula I am using is more or less:

=VLOOKUP("TOTAL",NAME_RANGE,MATCH("YY",NAME_RANGE) ,FALSE)

I should get 150.

What have I done wrong?

Cheers
TT








All times are GMT +1. The time now is 05:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com