# Help with a formula: conditional lookup (lookup only for values in another field)

**URL:** https://community.baserow.io/t/help-with-a-formula-conditional-lookup-lookup-only-for-values-in-another-field/7970
**Category:** Technical Help
**Created:** [November 27, 2024, 8:55pm UTC](https://community.baserow.io/t/help-with-a-formula-conditional-lookup-lookup-only-for-values-in-another-field/7970 "2024-11-27T20:55:10Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Mary-Lou](https://community.baserow.io/letter_avatar_proxy/v4/letter/m/4bbf92/32.png) [@Mary-Lou](https://community.baserow.io/u/Mary-Lou)
#### Post date: [November 27, 2024, 8:55pm UTC](https://community.baserow.io/t/help-with-a-formula-conditional-lookup-lookup-only-for-values-in-another-field/7970/1 "2024-11-27T20:55:10Z")

</div>

Hi,

My database has the following structure:

**Contacts**

- _Name_ (primary field, single line text)
- _Organisation_ (Link to Table: **Organisations** )
- _Projects_ (Link to table: **Projects** )

**Organisations**

- _Organisation Name English_ (primary field, single line text)
- _Coordinating Partner_ (Link to table: **Projects** )

**Projects**

- _Project Acronym_ (primary field, single line text)
- _Coordinating Partner Organisation_ (Link to table: **Organisations** )

This is what I would like to achieve:  
Create a _new field_ in **Contacts** that looks up **Projects** / _Project Acronym_, but only for projects linked in **Contacts** / _Projects_.

The formula needs to be something like that:  
If **Contacts** / _Projects_ is not empty, look up **Projects** / _Coordinating Partner Organisation_. If **Projects** / _Coordinating Partner Organisation_ equals **Contacts** / _Organisation_, list **Projects** / _Project Acronym_.

Is this something that can be done with a Baserow formula?

---

<div class="post-metadata">

### Author: ![Justin](https://community.baserow.io/letter_avatar_proxy/v4/letter/j/3ab097/32.png) [@Justin](https://community.baserow.io/u/Justin)
#### Post date: [November 29, 2024, 12:52pm UTC](https://community.baserow.io/t/help-with-a-formula-conditional-lookup-lookup-only-for-values-in-another-field/7970/2 "2024-11-29T12:52:03Z")

</div>

Hi Mary-Lou,

I think if the _Projects_ field in the **Contacts** table is empty, then any lookup will return blank.  
Therefore that condition is built in, you don’t have to recreate it.

So for the rest, we can do a formula field:

If there is only ever 1 linked project:  
if( lookup(‘_Projects_’,‘_Coordinating Partner Organisation_’) = field(‘_Organisation_’) , lookup(‘_Projects_’,‘_Project Acronym_’) )

If there could be multiple linked projects:  
filter( lookup(‘_Projects_’,‘_Project Acronym_’) , lookup(‘_Projects_’,‘_Coordinating Partner Organisation_’) = field(‘_Organisation_’) )

I haven’t tested these, so they might need tweaking.

---

<div class="post-metadata">

### Author: ![Mary-Lou](https://community.baserow.io/letter_avatar_proxy/v4/letter/m/4bbf92/32.png) [@Mary-Lou](https://community.baserow.io/u/Mary-Lou)
#### Post date: [November 29, 2024, 2:00pm UTC](https://community.baserow.io/t/help-with-a-formula-conditional-lookup-lookup-only-for-values-in-another-field/7970/3 "2024-11-29T14:00:46Z")

</div>

@Justin  
Thank you so much! Works like a charm! Brilliant.

---

<div class="post-metadata">

### Author: ![Justin](https://community.baserow.io/letter_avatar_proxy/v4/letter/j/3ab097/32.png) [@Justin](https://community.baserow.io/u/Justin)
#### Post date: [December 1, 2024, 9:58am UTC](https://community.baserow.io/t/help-with-a-formula-conditional-lookup-lookup-only-for-values-in-another-field/7970/4 "2024-12-01T09:58:02Z")

</div>

Awesome 🙂 And you’re welcome.

---

<div class="post-metadata">

### Author: ![Mary-Lou](https://community.baserow.io/letter_avatar_proxy/v4/letter/m/4bbf92/32.png) [@Mary-Lou](https://community.baserow.io/u/Mary-Lou)
#### Post date: [December 1, 2024, 10:15am UTC](https://community.baserow.io/t/help-with-a-formula-conditional-lookup-lookup-only-for-values-in-another-field/7970/5 "2024-12-01T10:15:02Z")

</div>

Coming from Excel, I find Baserow formulas rather unintuitive, unfortunately. I suppose this is because I only need them once every few months.

I am very very grateful for the help provided in this forum.

---

<div class="post-metadata">

### Author: ![Justin](https://community.baserow.io/letter_avatar_proxy/v4/letter/j/3ab097/32.png) [@Justin](https://community.baserow.io/u/Justin)
#### Post date: [December 2, 2024, 10:38am UTC](https://community.baserow.io/t/help-with-a-formula-conditional-lookup-lookup-only-for-values-in-another-field/7970/6 "2024-12-02T10:38:30Z")

</div>

Yeah, I get that.  
My journey has been Excel to ClickUp to Baserow. So actually compared to non-spreadsheet implementations of formulas, I think Baserow’s is pretty great.

And combined with the relational function, it can do lookups more reliably than a spreadsheet.
