+ Reply to Thread
Results 1 to 20 of 20

need lookup to display values as they are found

  1. #1
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    need lookup to display values as they are found

    Hi,

    I've attached a worksheet which has a hlookup in cell H6. It displays the values assigned to the options in the drop down menus above it, but only does this when all three are completed. Is there a way of getting it to display when they are incomplete?

    i.e.

    It only shows when all three are selected like "123". When one isn't completed it shows "#NA". if two are selected and the third blank, can it show "12" or if one is selected and two are blank, can it show "1"

    Suggestions appreciated

    Example.xlsx

  2. #2
    Forum Contributor
    Join Date
    01-29-2009
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    123

    Re: need lookup to display values as they are found

    Try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: need lookup to display values as they are found

    I don't know how this is working for you ..
    If it is then try this..
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  4. #4
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: need lookup to display values as they are found

    thanks for the replies guys.

    yours worked fine Glen - thanks!

  5. #5
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: need lookup to display values as they are found

    Hi,

    actually this code is returning an "error in value":

    =(IF(H2<>"",HLOOKUP(H2,B2:E3,2,FALSE),"")&IF(H3<>"",HLOOKUP(H3,B4:E7,2,FALSE),"")&IF(H4<>"",HLOOKUP(H4,B8:E15,2,FALSE),""))*1

    I add in the coloured code to the formula given by Glen above as it wasn't showing as a number and found this trick on another site.

    The code works but the cell has the green triangle in the top corner and says it has an "error in value" - it also displays "#VALUE!" when nothing is selected in the boxes. Is this something due to my code I added? I need the box to be blank when nothing's selected....

  6. #6
    Forum Contributor
    Join Date
    01-29-2009
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    123

    Re: need lookup to display values as they are found

    Try this then:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    It's basically saying:

    If all three cells are blank, return a blank.

    The rest of the formula was a modification to your original formula. Since you are only trying to return a value if a dropdown value is selected, I added in an if statement to do hlookup only if H2<>"" (meaning H2 is not blank). If H2 is blank, then it will return a blank, resulting a blank & the rest of the formula. So now it can be flexible enough to pick up whether the cell is blank or has a value.

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: need lookup to display values as they are found

    It appears that there is missing data in your example.....might be wrong

    Eg: There are no values given for EEE, FFF, GGG, HHH, YELLOW

    An arrangement like I have shown in orange might help as the table that you have is quite difficult to understand and it produces some strange Data Validation lists. I see that your DV lists are partly created by the rows labelled with the colours and some are not. I really don't know what you want or how you have determined what each row with the colours should have in it.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  8. #8
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: need lookup to display values as they are found

    Hi Guys,

    Thanks for your feedback!

    Glen, that makes perfect sense - actually spent too much time at work today researching this rather than doing what i was suppose to and got my head round the meaning of your coding not long after i posted about it; thanks again - your update works great and there's no error in the value now. fantastic

    And thanks newdoverman for your feedback as well - i admit it does look a little weird in it's present form but it's only for this example. If i can get the thing to work as it is now, the really data would make far more sense in the current layout. the values you mentioned were intentional missed - i didnt want to waster my time doing all of them if i could get the first two to work; idea being get the first one going, copy it to the second and if that works, repeat as needed.

    I see what you mean about the strange data validation. I did delete them - Yellow and green are not suppose to have a name list after them, but it keeps recreating them for some reason.. odd. Thanks again for your advice

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: need lookup to display values as they are found

    To get rid of the YELLOW. Go to the Name Manager, click on COLOUR and in the definition in field at the bottom of the dialogue box change the formula to be: =Sheet1!$B$2:$D$2

    That will get rid of the YELLOW in the Data Validation list.

    To get rid of the GREEN, go to the Name Manager and click on GREEN and click DELETE. That will eliminate the list for GREEN.

    It was these strange Data Validation lists that made me think that something was wrong with the example.

  10. #10
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: need lookup to display values as they are found

    Quote Originally Posted by newdoverman View Post
    To get rid of the YELLOW. Go to the Name Manager, click on COLOUR and in the definition in field at the bottom of the dialogue box change the formula to be: =Sheet1!$B$2:$D$2

    That will get rid of the YELLOW in the Data Validation list.

    To get rid of the GREEN, go to the Name Manager and click on GREEN and click DELETE. That will eliminate the list for GREEN.

    It was these strange Data Validation lists that made me think that something was wrong with the example.
    Thanks.

    I've just taken your advice about vertical listing the nameLists as well. it wasn't working for "Blue" horizontally when it was underneath "red", so i could see it just being a pain later on so did what you recommended. thanks again.

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: need lookup to display values as they are found

    The problem with the horizontal listing as it is, is that the lookup value ALWAYS looks in the first row of the array definition. The name changes with the choice in H2 but the range doesn't pick up the correct range from which to get a value.

    I think that you will find the vertical arrangement easier to work with.

    This file shows a possible array in Orange with the formula required in the Orange cell.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: need lookup to display values as they are found

    Quote Originally Posted by newdoverman View Post
    The problem with the horizontal listing as it is, is that the lookup value ALWAYS looks in the first row of the array definition. The name changes with the choice in H2 but the range doesn't pick up the correct range from which to get a value.

    I think that you will find the vertical arrangement easier to work with.

    This file shows a possible array in Orange with the formula required in the Orange cell.
    I assumed that was the case - It works fine now with the vertical lists and I've added all the name lists just to make sure. Glad you pointed that out as i would have missed it otherwise until it was way down the line and it would of really bugged me.

    I've now move on to the cell that's returning the link from the array dependent on the values selected in the drop down list. Its currently saved as a couple of Vlookups inside a hyperlink - one to return the link itself and the other to return the display text. I've got another thread going where I'm asking for advice / pointers on how to figure out getting it to return all the values in the array with the same starting numbers:

    ie.


    searching for 123456 would find and return:

    100000
    120000
    123000
    123400
    123450
    123456

    however searching for 123*** would find and return:

    100000
    120000
    123000
    123400
    123450
    123456

    I've looked at countif function but don't think that will work. Problem is i cannot loose the hyperlink function - the whole sheet is set up to return links from an array dependent on your search criteria. It's getting a little puzzling for my novice mind unfortunately. If you have any advice or a suggestion for a subject i should read up on i would appreciate it?

  13. #13
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: need lookup to display values as they are found

    You are looking at using wildcard lookups and I don't think that is possible in the application that you want to put it to. The wildcard will (if it works) give several matches but the lookup can only handle one. I'm not sure what the hyperlink function can handle. This might be possible with VBA but I don't know.

    Sorry, I can't be of further help.

  14. #14
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: need lookup to display values as they are found

    figured as much - thanks for looking though. guess im off to learn basic VBA

  15. #15
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: need lookup to display values as they are found

    Not sure if it's OK to reply to a closed thread, but regarding the multiple matches for the hyperlink, maybe the attachment could be useful.
    Attached Files Attached Files

  16. #16
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: need lookup to display values as they are found

    WHER's solution works very well.

  17. #17
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: need lookup to display values as they are found

    Quote Originally Posted by WHER View Post
    Not sure if it's OK to reply to a closed thread, but regarding the multiple matches for the hyperlink, maybe the attachment could be useful.
    Hi Wher,

    When you reply with stuff like that, it's certainly fine by me to reply to a solved thread!

    Would you mind talking me through it? I'll struggling to see the mechanics of it and i don't really want to copy and paste other people's work as i don't learn.

    I've got that you have used the hyperlink function and defined the Link_Location with:

    INDEX(O2:O17,SMALL(IF(ISNUMBER(MATCH(1*LEFT(M2:M17,I6),H6,0)),ROW(O2:O17)-1,""),ROWS(1:1))),

    and the friendly_name with:

    INDEX(O2:O17,SMALL(IF(ISNUMBER(MATCH(1*LEFT(M2:M17,I6),H6,0)),ROW(O2:O17)-1,""),ROWS(1:1)))

    gets a bit fuzzy for me after this...

    Edit:

    so LEFT(M2:M17,I6)...

    M2:M17 is the place to extract the characters from.
    I6 is the amount of characters to extract

    inside a MATCH Function which has this left function as part of it's look up value - what does the 1* before the LEFT function do?
    I assume the H6 within the MATCH function is the Lookup_array, and the "0" is the match type meaning "exact match only"?

    Which part of the code determines the "K" in the small function and what does"K" do?

    Is the SMALL function what is causing the cells to return an #NUM value when nothing is selected, meaning the array is empty?


    and thank you so much for this Wher - it's a thing of beauty!
    Last edited by inq80; 09-06-2014 at 07:53 PM.

  18. #18
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: need lookup to display values as they are found

    what does the 1* before the LEFT function do
    :the result of "Left" is always text (even if it looks like a number), so multipying by 1 makes it a "real" number without changing the value. "+0" or "-0" or dividing by 1 would have the same result.
    Which part of the code determines the "K" in the small function and what does"K" do?
    ROWS($1:1) (giving 1 as result) is the K-number (notice the "$" sign), dragging the formula down will give ROWS($1:2) giving 2 as result, etc..
    SMALL(Range, 1) will give the smallest number from the range, SMALL(Range, 2) the second smallest, etc..
    I suggest you use the "Evaluate formule"button to step through the formula (many times...), this should give you a better understanding of how this sort of formula works. Notice also that it's an Arrayformula, confirmed with ctrl+shift+enter, not just enter.

  19. #19
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: need lookup to display values as they are found

    Thanks Wher,

    I've spent most of today looking through this so your comments are helpful.

    I'm still trying go figure out why I'm getting #NUM when nothings' selected.

  20. #20
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: need lookup to display values as they are found

    Take a look at the attachment (.jpg of the "Evaluate Formula")
    You will notice that in the step right before the #NUM error, the formula tries to determine the smallest (=Small,..,1) number from an array containing no numbers.
    This leads to the #NUM error. Similarly formula that would try to determine the third smallest from 2 numbers would lead to a #NUM error.
    Attached Images Attached Images

  21. #21
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: need lookup to display values as they are found

    oh right, can that not be put inside a COUNTERBLANK function to return "" if nothing is found?

    actually - yes it can! only works for when it's blank though, so will need to figure out where to put it when it's found all the results available:

    {=IF(COUNTBLANK($I$2:$I$4)=3,"",(HYPERLINK(INDEX($P$2:$P$33,SMALL(IF(ISNUMBER(MATCH(1*LEFT($N$2:$N$33,$J$6),$I$6,0)),ROW($P$2:$P$33)-1,""),ROWS($1:21))),INDEX($O$2:$O$33,SMALL(IF(ISNUMBER(MATCH(1*LEFT($N$2:$N$33,$J$6),$I$6,0)),ROW($O$2:$O$33)-1,""),ROWS($1:21))))))}
    Last edited by inq80; 09-07-2014 at 01:53 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Formula to lookup two values in a row and return a value if both are found
    By onbeillp111 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-01-2014, 01:33 PM
  2. Need Formula to Display the values not found using vlookup
    By Corina in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-13-2014, 11:16 PM
  3. Lookup in one table and display two values in another
    By pafranklin in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-01-2012, 05:40 PM
  4. Replies: 1
    Last Post: 06-26-2009, 06:16 PM
  5. Match mutliple values and then display text if found
    By Weasel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-21-2008, 07:58 PM

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