I've got a table, each column header is a month, each row is a year, and each cell has a number in it.

I'm trying to write a function that will search the table for a number that I specify, then return the month and year associated with that cell.

So far, I have this, my lookup function:

CHAR(MATCH(B52,A12:N12,0)+64)&TEXT(MATCH(B52,B1:B48,0),0)

Which, for the size of my table, returns the cell address in text form. B52 is just a reference to another cell, where I can enter the value to be located.

I also have this, my display function:

HLOOKUP(B12,B12:B49,38)&", "&TEXT(VLOOKUP(B12,B12:N12,13),0)

Which displays the appropriate month and year, formatted as I want them. It relies on the reference to B12, where B12 is what is displayed by my lookup function. However, I know that my display function can't read in the lookup function, because the references in the display function aren't text.

What I'm in need of, then, is a way to take something like B12 in text form, and actually get the cell reference in a way that it can be used by another function.

Ideally, I'd like something like this:

HLOOKUP(CHAR(MATCH(B52,A12:N12,0)+64)&TEXT(MATCH(B52,B1:B48,0),0),CHAR(MATCH(B52,A12:N12,0)+64)&TEXT(MATCH(B52,B1:B48,0),0):CHAR(MATCH(B52,A12:N12,0)+64)&TEXT(MATCH(B52,B1:B48,0)+37,0),38)&", "&TEXT(VLOOKUP(CHAR(MATCH(B52,A12:N12,0)+64)&TEXT(MATCH(B52,B1:B48,0),0),CHAR(MATCH(B52,A12:N12,0)+64)&TEXT(MATCH(B52,B1:B48,0),0):CHAR(MATCH(B52,A12:N12,0)+77)&TEXT(MATCH(B52,B1:B48,0),0),13),0)

That's a lot, but essentially, where display function reads in B12, I put in the lookup function; where it reads in B49, I put in the lookup function with the 12 portion augmented by 37; and where it reads in N12, I put in the lookup function with the "B" character code augmented by another 13. But, like I said, I know that won't work out.

I'm not trying to get anything super simple, I'm okay with a messy function, I just want to get it to do what I want. I have no idea how to write a macro to cycle through the table or anything like that, because I don't know how to write in Visual Basic.

Any help is appreciated in advance!