+ Reply to Thread
Results 1 to 2 of 2

Cell lookup and output issue...

  1. #1
    Registered User
    Join Date
    05-21-2007
    Posts
    79

    Cell lookup and output issue...

    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!

  2. #2
    Registered User
    Join Date
    05-21-2007
    Posts
    79
    Bad form to reply to my own topic, I know, but I didn't want to overload the first post.

    If anyone can suggest an alternative way to do this, I'm wide open to suggestions.

    The ultimate goal of this is, for any value in the table (they're all different), to display the month and year (row header and column header, which I've actually placed at the end of the rows and columns, for the lookup functions) of the value's cell. This will mean that I need to automate the ranges defined by the lookup functions based on the match function.

    The match function only gives me back the position relative to the array defined, so I'm really unsure as to how I can automate that to correctly select the arrays I need.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1