# Partial or fuzzy lookup

**URL:** <https://community.easymorph.com/t/partial-or-fuzzy-lookup/1697>\
**Category:** General Q&A\
**Created:** [February 26, 2020, 12:50am UTC](https://community.easymorph.com/t/partial-or-fuzzy-lookup/1697 "2020-02-26T00:50:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![raskarov](https://community.easymorph.com/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@raskarov](https://community.easymorph.com/u/raskarov)\
**Post date:** [February 26, 2020, 12:50am UTC](https://community.easymorph.com/t/partial-or-fuzzy-lookup/1697/1 "2020-02-26T00:50:48Z")

</div>

I'm trying to figure out to lookup values with "CONTAINS" statement and using multiple conditions.

Here are some examples:

Lookup table has the following values:

```
Col 1 Return Val
CINCINNATI CIN
COLUMBUS, OH CL1
COLUMBUS, GA CLGA
DENVER DN

```

Main table has the following columns:

```
City State   
CINCINNATI OH
COLUMBUS GA
DENVER CA

```

The problem is that lookup table has optional state while it is always present in the main table, so I'm not sure how to perform correct lookup.

Thank you!

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [February 27, 2020, 11:27pm UTC](https://community.easymorph.com/t/partial-or-fuzzy-lookup/1697/2 "2020-02-27T23:27:14Z")

</div>

In this case, I would do it as a 2-phase lookup. First with the stricter condition, and for remaining empty values - with the looser one.

See the example below.  
[2-phase-lookup.morph](https://community.easymorph.com/uploads/short-url/nfnr4o7wX53X2SEaJU5NJ5AzAGt.morph) (4.5 KB)  
[Book1.xlsx](https://community.easymorph.com/uploads/short-url/i8q2GEktwo9nSqnCf78Csesal9g.xlsx) (9.9 KB)

 ![image](https://community.easymorph.com/uploads/default/original/2X/9/9e65fe582a82ce3de5ec546b3592800cbc3fb43b.png)

It can be possible to generalize the approach: do all the lookups corresponding to parts of the lookup condition, then use the "Rule" action as in the example to pick the correct lookup value.
