# Lookup/pull a value from a table based on input values

**URL:** <https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449>\
**Category:** Ask the Community\
**Created:** [April 9, 2019, 7:59am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449 "2019-04-09T07:59:10Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Denhoed](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Paul\_Denhoed](https://connect.superhuman.com/u/Paul_Denhoed)\
**Post date:** [April 9, 2019, 7:59am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/1 "2019-04-09T07:59:10Z")

</div>

First off, I’m a total noob.  
I’m trying to create a document that looks up (and displays) a shipping cost (from a table) based on values that the user enters. I would have thought that this would be fairly simple, but I haven’t been able to find anything that helps me get to that point.  
I have a table, with shipping zones in columns, and weight in rows. I want to input, for example, 8 for the weight, and Europe for the zone, and have the doc look up from the table that the charge for 8kg to Europe is $50.  
I suspect I should be able to use filter or lookup, but can’t get my head around how to implement it.

Any help would be much appreciated.

---

<div class="post-metadata">

**Author:** ![Nick\_Milner](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/nick_milner/32/8249_2.png) [@Nick\_Milner](https://connect.superhuman.com/u/Nick_Milner)\
**Post date:** [April 9, 2019, 8:20am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/2 "2019-04-09T08:20:52Z")

</div>

Hi Paul,

Create a table of charges and a table of shipments. Link the shipments to the charges with lookup:

 ![38](https://global.discourse-cdn.com/coda1/original/2X/6/69a8bb8a41ba53a1204c1ac579ad88a2ef2229c7.png)

The column that automatically appears in the Shipments table is the one with the “flag” next to it in the charges table.

Then create a column in the shipments table and use a formula to pull the charge amount from the charges table:

 ![02](https://global.discourse-cdn.com/coda1/original/2X/1/1823408aa8175f1262c6686b820962e6580164ed.png)

The green “Region” blob in the formula is a reference to the Region column in the shipments table (it has a dotted line around it like formula references do in Excel). The pink “Charge” blob means a column pulled “through” the reference from the charges table.

Is this what you want to do?

---

<div class="post-metadata">

**Author:** ![Paul\_Denhoed](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Paul\_Denhoed](https://connect.superhuman.com/u/Paul_Denhoed)\
**Post date:** [April 9, 2019, 8:26am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/3 "2019-04-09T08:26:16Z")

</div>

Thanks for your help, Nick!  
That’s not quite what I’m looking for.  
The shipping charge is dependant on both the region and the weight of the package. I see what you’ve done to lookup from one column, but what if I have 5 or 30 and I want a value from a specific column?

![56%20PM](https://global.discourse-cdn.com/coda1/original/2X/e/e47b680968a1e6dbd706a603ffedf30901833bba.png)

---

<div class="post-metadata">

**Author:** ![Paul\_Denhoed](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Paul\_Denhoed](https://connect.superhuman.com/u/Paul_Denhoed)\
**Post date:** [April 9, 2019, 8:32am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/4 "2019-04-09T08:32:38Z")

</div>

I was able to get _close_ using the following formula:  
 ![18%20PM](https://global.discourse-cdn.com/coda1/original/2X/4/4dd944fe4a7e18bea9349e970b5dff7f14315aad.png)  
where PkgWeight is a number input elsewhere in the document, but I also have an select box for the destination, which I would like the doc to use to look up the shipping price.

---

<div class="post-metadata">

**Author:** ![Paul\_Denhoed](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Paul\_Denhoed](https://connect.superhuman.com/u/Paul_Denhoed)\
**Post date:** [April 9, 2019, 8:36am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/5 "2019-04-09T08:36:46Z")

</div>

I have these select boxes:  
 ![04%20PM](https://global.discourse-cdn.com/coda1/original/2X/5/5b98236f38bf4668454e40bb02e8443dee8ec0d2.png)  
and I’m hoping that by changing the selection in each of these boxes it will show me the correct price.  
Right now, I’ve simplified things such that it doesn’t make a lot of sense to do all this work to get the formula running when I can just look it up “with my eyes”, but eventually I want to have more complex data and multiple lookups from different tables. I simplified things just to see if I could get it to work.

---

<div class="post-metadata">

**Author:** ![Nick\_Milner](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/nick_milner/32/8249_2.png) [@Nick\_Milner](https://connect.superhuman.com/u/Nick_Milner)\
**Post date:** [April 9, 2019, 8:37am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/6 "2019-04-09T08:37:11Z")

</div>

**Duh, I see you have the charges in columns (and you _did_ say that and I skimmed right over) - this isn’t good database design tbh because it leads to problems like the one you’re experiencing!**

If you change the lookup back to a list…

 ![28](https://global.discourse-cdn.com/coda1/original/2X/0/068b72834672866124bf570a815660a2f63c10d0.png)

…and then use the following formula I think you get what you want. It’s probably not the best way to solve the problem though!

![51](https://global.discourse-cdn.com/coda1/original/2X/3/3edc4035c4da3659801ee1936af746f873ae688b.png)

Final result:

![40](https://global.discourse-cdn.com/coda1/original/2X/c/c824ece8ae5c4ab654dead51e1bd692fe63badce.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Milner](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/nick_milner/32/8249_2.png) [@Nick\_Milner](https://connect.superhuman.com/u/Nick_Milner)\
**Post date:** [April 9, 2019, 8:46am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/8 "2019-04-09T08:46:51Z")

</div>

Actually, this looks better (uses groups to make the result look like your original, with regions in columns)…

![22](https://global.discourse-cdn.com/coda1/original/2X/9/951611f62bc851071bdb8dc591a020d15dd33c6f.png)

---

<div class="post-metadata">

**Author:** ![Paul\_Denhoed](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Paul\_Denhoed](https://connect.superhuman.com/u/Paul_Denhoed)\
**Post date:** [April 9, 2019, 8:50am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/9 "2019-04-09T08:50:42Z")

</div>

Thanks, Nick. Because I don’t know what I’m doing, I’m not sure how to implement what you are suggesting. Are you aware of a help document, or at minimum can you tell me what you’ve done here is called? It looks promising and I’d like to give it a try!

---

<div class="post-metadata">

**Author:** ![Nick\_Milner](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/nick_milner/32/8249_2.png) [@Nick\_Milner](https://connect.superhuman.com/u/Nick_Milner)\
**Post date:** [April 9, 2019, 8:52am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/10 "2019-04-09T08:52:17Z")

</div>

Are you referring to the table structure itself, the formula I used to pull the data into the shipments table, or the grouping I used to make the “flat” shipments table look like your original table with regions along the top?

---

<div class="post-metadata">

**Author:** ![Paul\_Denhoed](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Paul\_Denhoed](https://connect.superhuman.com/u/Paul_Denhoed)\
**Post date:** [April 9, 2019, 8:53am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/11 "2019-04-09T08:53:44Z")

</div>

😬All of the above, possibly, but mostly the latter!

I’ve discovered the Grouping help page, and I’m having a look at that for now.

---

<div class="post-metadata">

**Author:** ![Jean\_Pierre\_Traets](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/jean_pierre_traets/32/16275_2.png) [@Jean\_Pierre\_Traets](https://connect.superhuman.com/u/Jean_Pierre_Traets)\
**Post date:** [April 9, 2019, 8:57am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/12 "2019-04-09T08:57:15Z")

</div>

Dear @Nick_Milner,

Thanks for your support with the question of @Paul_Denhoed.🤝

💡  
If you are OK with my suggestion, why not to share you sample doc with Paul to make it for him more easy to understand as your support looks great. (I am at my mobile device, traveling)

---

<div class="post-metadata">

**Author:** ![Nick\_Milner](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/nick_milner/32/8249_2.png) [@Nick\_Milner](https://connect.superhuman.com/u/Nick_Milner)\
**Post date:** [April 9, 2019, 9:00am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/13 "2019-04-09T09:00:07Z")

</div>

Relational table design can be a bit of a black art (look up relational normal forms for the dry facts!) but the essence of the change here is that each “new piece of data” (i.e. a regional charge) should be on a separate row in the table, not a column. It means you can view and manipulate the data a lot more easily because the column you’re interested in is the same regardless of which region you’re working with.

The formula is a straight lookup and I think should be pretty self-describing. There’s probably a nicer way to do this via properly linked tables (in my revised example above the two tables aren’t linked at all - I _make_ the link myself in the formula).

The grouping is dead easy, actually. 🙂

Just click the group button and add the two groups as follows:

![35](https://global.discourse-cdn.com/coda1/original/2X/f/f05ee101dfb699a35b4c3507f47a2710e31995ee.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Milner](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/nick_milner/32/8249_2.png) [@Nick\_Milner](https://connect.superhuman.com/u/Nick_Milner)\
**Post date:** [April 9, 2019, 9:00am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/14 "2019-04-09T09:00:59Z")

</div>

I actually don’t know how. 🙂 I’ve only been using Coda myself for a few days (testament to how easy it is to pick up!)

---

<div class="post-metadata">

**Author:** ![Paul\_Denhoed](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Paul\_Denhoed](https://connect.superhuman.com/u/Paul_Denhoed)\
**Post date:** [April 9, 2019, 9:04am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/15 "2019-04-09T09:04:17Z")

</div>

Thanks. My head is spinning; I may need a few minutes to absorb this!

---

<div class="post-metadata">

**Author:** ![Paul\_Denhoed](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Paul\_Denhoed](https://connect.superhuman.com/u/Paul_Denhoed)\
**Post date:** [April 9, 2019, 9:19am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/16 "2019-04-09T09:19:01Z")

</div>

errr, stupid questions: You have the Charges table, which I believe is, in essence, the same as (or serving the same function as) my Table 1. But I’m not grokking what the Shipments table does!?  
Also, what does the Charges table look like BEFORE the grouping is applied?

---

<div class="post-metadata">

**Author:** ![Jean\_Pierre\_Traets](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/jean_pierre_traets/32/16275_2.png) [@Jean\_Pierre\_Traets](https://connect.superhuman.com/u/Jean_Pierre_Traets)\
**Post date:** [April 9, 2019, 9:19am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/17 "2019-04-09T09:19:09Z")

</div>

Hi,

In the below post I explained how to share a doc:

> [@How to add coda doc example here on the community site](https://connect.superhuman.com/t/how-to-add-coda-doc-example-here-on-the-community-site/7355/2):
>
> Hi @Roar_Gjovaag In the doc you want to share, go to the share button A menu will appear in the middle of your screen as in the screenshot below Select “copy link”, then choose anyone with link and set your “access rights” in the screenhot they are “can view or play” ( for the community the best option in most cases)

_The learning curve for Coda is rather depending on the users background_

Glad to see how you less experienced users support onboarding, even at your early stage at Coda 😀

---

<div class="post-metadata">

**Author:** ![Nick\_Milner](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/nick_milner/32/8249_2.png) [@Nick\_Milner](https://connect.superhuman.com/u/Nick_Milner)\
**Post date:** [April 9, 2019, 9:21am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/18 "2019-04-09T09:21:52Z")

</div>

/see post further down…

---

<div class="post-metadata">

**Author:** ![Paul\_Denhoed](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Paul\_Denhoed](https://connect.superhuman.com/u/Paul_Denhoed)\
**Post date:** [April 9, 2019, 9:31am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/19 "2019-04-09T09:31:28Z")

</div>

Hmmm, ok, I _think_ I see what’s going on with the Charges table…  
I’m still not sure about the Shipments table, but…

I’m going to try to create a new table with Region as the first column, with 10 rows for each region (total 40), then 1-10 for each region in the Weight column, and the corresponding prices in the Charge column.  
Then, group as you have done in your example, and go from there.

This’ll take me some time, and I need to break for dinner now, and not sure when I’ll have a chance to get back to this, but I will report back here in a few days (or earlier?) with my progress.

THANKS very much for your assistance! I really appreciate it.

---

<div class="post-metadata">

**Author:** ![Nick\_Milner](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/nick_milner/32/8249_2.png) [@Nick\_Milner](https://connect.superhuman.com/u/Nick_Milner)\
**Post date:** [April 9, 2019, 10:10am UTC](https://connect.superhuman.com/t/lookup-pull-a-value-from-a-table-based-on-input-values/7449/20 "2019-04-09T10:10:13Z")

</div>

Here’s another version where I’ve added a grouped _view_ of the Charges table. The key here is that both “Charges” and “View of Charges” are essentially the same thing. “Charges” is the underlying table that shows the raw data. “View of charges” is just a window onto “Charges” that has been grouped to look like your earlier example. Hope this helps.

https://coda.io/embed/-huWFciU1S/_suvG0?viewMode=embedplay
