+ Reply to Thread
Results 1 to 13 of 13

Tricky dynamic HLOOKUP (Or better way do to it??)

  1. #1
    Registered User
    Join Date
    08-14-2007
    Posts
    11

    Tricky dynamic HLOOKUP (Or better way do to it??)

    Hi guys,

    Maybe this problem will intrigue some great minds here

    I run a web query to populate a table in my spreadsheet. The data is dynamic - and on some days, I will get a couple of extra rows in the table (its weather data, so e.g. when its raining, they will forecast an extra row of how many mm, etc...)

    To give a simple example, right now I use Hlookup to locate the value of F3 (the date) in my dynamic range of B26:G26 and step down 3 rows, where my needed temperature values are for that corresponding day. This works great like this already: =HLOOKUP(F3,B26:G29,3,FALSE)

    The big issue is...what happens if my target values are not always 3 rows down? If the query refreshes with any extra rows, this reference is shifted. (Well, my starting "Anchor" is shifted)

    Any suggestions? Maybe there is a very simple solution, and I'm just missing it. Much much much appreciated!
    Last edited by bluepenguin; 08-29-2007 at 03:29 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Is it always the last row of data you're after? i.e. after that there are blank rows?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    You need to post a sample of the data for a day when it is raining and a day when it is not to let us have a better idea of what you want.

    Regards

    Dav

  4. #4
    Registered User
    Join Date
    08-14-2007
    Posts
    11

    exapmle posted

    Here it is, with notes inside!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-14-2007
    Posts
    11
    Quote Originally Posted by NBVC
    Is it always the last row of data you're after? i.e. after that there are blank rows?
    No unfortunately, I think its a bit more complicated.. please see the attachment.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Would something like this in C4, copied down 2 rows and across 6 columns work?

    =INDEX($A$22:$G$30,MATCH($B4,$A$22:$A$30,0),MATCH(C$3,$A$23:$G$23,0))

    Edit: So the formula will look for whatever row have the words "High" and "Low" to get its results....
    Last edited by NBVC; 08-29-2007 at 04:33 PM.

  7. #7
    Registered User
    Join Date
    08-14-2007
    Posts
    11

    Thumbs up

    WOW, thank you thank you thank you thank you!!!!!

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by bluepenguin
    WOW, thank you thank you thank you thank you!!!!!
    You're very welcome!

  9. #9
    Registered User
    Join Date
    08-14-2007
    Posts
    11

    Ahh...

    NBVC - Sorry to have to resurrect this. There is one issue with this function.

    =INDEX($A$25:$G$32,MATCH($B4,$A$25:$A$32,0),MATCH( E$3,$A$26:$G$26,0))

    The date values will not always be in row 26! When the web query updated, it just threw it into row 25, and it didn't work.. I tried setting the last Match to have an "OR row 25" but it didn't work.

    I'm sure there is a solution to this - again, very much appreciated!

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    If it will always be either row 25 or row 26, then try:


    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-14-2007
    Posts
    11
    I think that its either, or.

    LOL - that's a scary looking formula. Thanks for your help.

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    No problem...

    It's basically the same formula twice put into an IF() statement ...which checks to see if the dates are firstly in row 25. If the dates are there it executes the middle part of the formula which uses row 25 in the Match() portion you referenced. Otherwise it will execute the last part which uses row 26 for dates...

  13. #13
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Not necessarily less scary but perhaps a little shorter.......

    =INDEX($A$25:$G$32,MATCH($B4,$A$25:$A$32, 0),LOOKUP(10^10,CHOOSE({1,2},MATCH(E$3,$A$26:$G$26,0),MATCH(E$3,$A$25:$G$25,0))))

+ 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