I’m looking for a formula, that gives me back the cell address of a vlookup
based on a date and a related 2-dim (array) 'Table!$A$4:$M$65'
of month/year.
4/30/1990 VLOOKUP(YEAR(L12),Table!$A$4:$M$65,MONTH(L12)+1))
The lookup works fine and give me back the value of the looked up cell, but I additionally want the cell adress like E32.
Any idea how to ?
thanks in advance, Mole65
Using a combination of ADDRESS
and MATCH
should help:
=ADDRESS(MATCH(YEAR(L12),Table!$A$1:$A$26,0),MATCH(MONTH(L12),Table!$A$1:$M$1,0))
Table:
Answer:
I always suggest using INDEX
/MATCH
instead of VLOOKUP
.
INDEX
/MATCH
can do everything VLOOKUP
(and HLOOKUP
) can do but it is:
- faster (important when used in many cells);
- more versatile (the value you are looking up does not need to be in a column to the right);
- more robust (inserting columns does not break it);
- easier to use (no column counting required);
If you used an INDEX
/MATCH
formula, such as this:
=INDEX(Table!$B$4:$M$65,MATCH(YEAR(L12),Table!$A$4:$A$65,0),MATCH(MONTH(L12),Table!$B$3:$M$3,0))
You could put it straight into a CELL
function to return the full address:
=CELL(
"address",
INDEX(Table!$B$4:$M$65,MATCH(YEAR(L12),Table!$A$4:$A$65,0),MATCH(MONTH(L12),Table!$B$3:$M$3,0))
)
AUTOMATICALLY COLOUR THE VALUE IN THE TABLE
You do not need the address to highlight the value in the table.
Just create a conditional formatting rule for $B$4:$M$65
:
=AND(MONTH(Sheet2!$L$12)=B$3,YEAR(Sheet2!$L$12)=$A4)
Tags: excelexcel