2

Nothing I do seems to work here.

Text is:

So I'm trying to nest multiple lookups, which can't be the intelligent way to do this (formula In 2nd, incident-based worksheet). Innermost/first lookup: use state in incident worksheet: find all applicable years in 1st worksheet that only apply to this state (I'm returning a range of rows, after searching by row?? state is a column, as is year. month is a row (first column header). Middle/second lookup: use year in incident worksheet: find within returned range of years from above (a subset of rows), exact row, containing month Jan-Dec (remember that months are columns, ie column labels) for the appropriate State-Year pair. Outermost lookup: use month in incident worksheet: find within returned range of months from second lookup, exact month (at this point, ideally this would be the exact unemployment rate).

Edited in: just trying to make it as clear as I can:

Worksheet 1) Unemployment Rates: State Year Jan Feb Mar April etc AK 1991 3.5 4.3 5 6.1 x
AK 1992 3.1 4.1 x x x TX 1991 x x x x x TX 1992 x x x x x VA 1993 x x x x x VA 1994 x x x x x

Worksheet 2) Incidents: Exact Calendar Date Year State xxx xxx etc (formula to reference applicable unemp rate) xx/xx/xxxx xxxx xx x x x ????? xx/xx/xxxx xxxx xx x x x ?????

=hlookup(month(b2),vlookup(c2,(vlookup(av2,[in first worksheet with unemp. rates, all states, in alphabetical order and first column]A2:a1174,[years in worksheet 1 that apply to this state, range is all years, but nested lookup means it will only look at the ones with the correct state abbreviation, right?]b2:b1174),[in the unemp rate worksheet, for the 1 row year/state combination that is returned, search among all months]$c$1:$n$1),*****)

Trying to provide notes here to make the above more clear: b2 = month in incident worksheet (#2 in my original post) c2 = year in incident worksheet av2=state abbreviation in incident worksheet ***** So this is one question among many. Conceptually, at this point I wanted to have the last hlookup function search by month among the appropriate year/state row, and return the exact cell I want. But, it has become so convoluted I don't know how to reference the last returned value.

Thank you for any help! Let me know if I can provide more clarity.

I have tried every combination of ctrl+k, bracket tool, manual indent, on both the example dummy tables and the hlookup formula (the first of which is not code, but maybe it thinks it is?), and although they will appear gray below in the preview, I still get the error.

Edit: I've now deleted everything that could possibly be construed as code on the post, and it still tells me I have improperly formatted code. This pertains to an actual question, not a comment.

5
  • 1
    You're not supposed to use comments for big blocks of code that need copious amounts of formatting.
    – Makoto
    May 11, 2014 at 8:22
  • I understand that. There are two separate questions. May 11, 2014 at 8:27
  • @user3392615: one question at a time. Comment formatting is severely limited, click on the help link below the "add comment" button.
    – Mat
    May 11, 2014 at 8:28
  • 1
    @user3392615: I don't see any (markdown) formatting at all in the source (here) that you posted originally here. No indentation, no code markers. And you've got a lot of code-like stuff in the middle of your paragraphs - and your =hlookup thing is a weird mix of English and code... I have no idea how to format that - if that's "inline comments", move them out of line in a separate paragraph and format the rest as code.
    – Mat
    May 11, 2014 at 8:39
  • I have been having trouble with code block editing recently as well. I suggest to add the bug tag to the post.
    – Patrick
    May 11, 2014 at 8:50

0

You must log in to answer this question.

Browse other questions tagged .