Lookup problems

Hello,

I am trying to make a document that gets a search word from a cell, and then search multiple cells for that search word, and if any of the searchwords names appear in the cells, then returns the value of a specific cell.

You can see what i am trying to do here - http://www.anacropolis.dk/numbers/Cellcheck.numbers

My problem is currently that LOOKUP returns the value fine when i am only checking one cell, but fails when i am checking multiple cells.


Any tips/trick are most appreciated.

Thanks!

Regards...Jklarsen

Macbook Pro, Mac OS X (10.6.5), Numbers 2.0.4..

Posted on Dec 8, 2010 5:59 AM

Reply
19 replies

Dec 8, 2010 6:46 AM in response to Jerrold Green1

Sorry!

I want the formula to get at searchword from B5 and then check "References" B3:B6 for that searchword, and if it finds the searchword, then return D5 in the F5 cell.

More specifically this example, i want to check if the word "Jan" is present in the cells "Client#1" and if present then return 300.000 to F5.

The formula only works when searching a single cell, and not when searching multiple cells. And i cannot figure what the problem is....

Or if you have a tip for a smarter way to search multiple cells for a searchword and then return the value of a specified cell, that would be much appreciated.


Best...Jklarsen

Dec 8, 2010 7:50 AM in response to jklarsen

Still a bit unclear on your request.

You are searching multiple cells for a specified search term in your Numbers document, and it works. Only when the search term you specify isn't found in the search range you specify do you get an error. You can use IFERROR or ISERROR to handle the result differently.

If you are asking "how do I search for multiple search criteria at once in a single function", I don't know of any way.

Jerry

Dec 8, 2010 9:09 AM in response to Jerrold Green1

Hello again,

Sorry for my lack of explainability 😉

The problem is that the formula doesn't work.

If you look at the Searchwords the first word is "Ib" and the first word in the client#1 list is "Ib" but the formula doesn't find "Ib" and therefore returns an error/Nothing. So my question is, what can i do differently? Since it should find "Ib"

And to clarify, i want to search multiple cells for ONE search word......

Hope this clarifies my problem.

Dec 8, 2010 9:28 AM in response to jklarsen

Your lookup in G5 is searching in References column C but "Ib" is in column B of that table. Similar problem with your formula in H5 which is searching in column D of References. Lookup will do a "close match" which may explain why the formula in H5 isn't giving you an error.

I'm not sure what it is you are trying to do. Typically, LOOKUP is used to find something in one column of a lookup table and return something from another column of the lookup table. Your formula is looking in the lookup table (References) but returning a value from Table 1.

Dec 8, 2010 10:14 AM in response to Badunit

I have simplified it a bit, if you look at the picture you can see the formula,
getting the searchword in B5, search the cells B16:B19 and in case it finds a match it returns the value of D5.

You can also clearly see that the searchword is "Hans" and that "Hans" exists in the B16:B19 cells the formula searches, so what am i doing wrong?
The weird thing is that the H5 formula which searches D16:D18 apperently finds "Hans" when it doesn't exist in those cells.
http://www.anacropolis.dk/numbers/Cell2.png

I am very confused and must be doing something wrong, i am also new to Numbers, so any insights will be must welcome...


Best...Jan

Dec 8, 2010 10:14 AM in response to jklarsen

JK,

A good place to start would be to clean up your table by getting rid of unused columns and rows.

Both of your tables could use the Header Row for the column titles. Those titles should be kept out of the body rows. Also, neither table needs or should have a Header Column, as far as I can tell. If you tidy this up, your formulas will be easier to write and to visually confirm.

To Badunit's point, your splitting the function across tables is unconventional, but is not the cause of your error. In fact, I thought it was a rather clever way to effect an IF case for the amount. The error, as Badunit mentions, is caused by the searched-for value not being in the range where you looked.

Jerry

Dec 8, 2010 10:45 AM in response to jklarsen

The problem appears to be misuse of the LOOKUP function. It doesn't work when your lookup range is one size but the return-value range is a different size. I am guessing it is trying to find the second value in cell D5 to match Hans being the second value in the lookup table and, of course, there is no second value to be returned.

Alternative formula:
=IF(ISERROR(LOOKUP(B5,B20:B23)),"no match",D5)

The formula above may match to a "close match". To make it be exact matches only,
=IF(ISERROR(VLOOKUP(B5,B20:B23,1,0)),"no match",D5)

Dec 8, 2010 10:55 AM in response to Badunit

Thank you for your swift feedback!

I have cleaned up the sheet and tried the new formula.
http://www.anacropolis.dk/numbers/cell3.png
As you can see in the image it puts in the value of C5 even when it clearly cannot fint the searchword, unless i delete the entire clienlist, but that sort of defeats the purpose.....

Due to the danish charmap numbers have switched the , with ;....

Best...Jan

Dec 8, 2010 11:05 AM in response to jklarsen

!http://i618.photobucket.com/albums/tt262/jpb45un2/a5bfa56a.png!

Jan,

This might be what you are looking for. Here are the formulas I used.

Found/Not found: =IF(ISBLANK(A), "", IF(COUNTIF(ClientLists :: A:C, A)>0, "Found", "Not Found"))

Client#1: =IF(COUNTIF(ClientLists :: A, $A)>0, $C, "")

Fill across, then Fill Down all four columns.

Footer row, Client1: =SUM(E)

Fill Across.

Is this close? (Sorry my amount column wasn't wide enough in the screen shot.)

Jerry

(I didn't look back to see the 2 previous posts, but I'll leave this as is.)

Message was edited by: Jerrold Green1

Dec 13, 2010 7:22 AM in response to Badunit

Hello again,

Thank you again for your excellent support the last time!
I want to press my luck and ask a last question.

I have the exact same setup, only this time the searchwords are not singlewords,
but multiple words in each cell.
I still want to check if any of the words in B5 is present in B16:B19, what do i need to change?

User uploaded file
For this example i want to check if B16:B19 contains any of the words in B5,
i.e. i want the D5 formula to see if it can find "Kim" from B5 in the B16:B19 cells.


Regards...Jan

Dec 13, 2010 9:07 AM in response to jklarsen

I don't think that is possible in a simple formula. You can find "Kim" in the string "payed by Kim" but you can't do it the other way around. You will have to parse the SearchWords into individual words. "Payed by kim" will be parsed into "payed", "by", and "Kim". You would have to do a countif on each of those words then have a formula that looks at those results and returns the match. This sounds to me to be a lot of work.

Alternative to all that parsing and matching, you could require the SearchWords to start with (or end with) the customer's name. Three of your four examples have the client as the last word and the one that wasn't could have been that way. With that structure, you can easily get the client name from the string. Here is a post that shows how to get the last word of a sentence:

http://discussions.apple.com/thread.jspa?messageID=12486148&#12486148

Do that in in another column and use that column as the client name for the rest of your formulas.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Lookup problems

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.