# Thunkable and returns a corresponding value from my sheet

**URL:** <https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081>\
**Category:** Questions about Thunkable X\
**Created:** [June 1, 2023, 3:00am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081 "2023-06-01T03:00:11Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![blvckrosesssppi](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blvckrosesssppi](https://community.thunkable.com/u/blvckrosesssppi)\
**Post date:** [June 1, 2023, 3:00am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/1 "2023-06-01T03:00:11Z")

</div>

Hi. I am trying to do a search bar that would return a corresponding value to the item i searched in my google sheets. For example, column A in my sheets are names. when i searched “james”, it would return the value corresponding it in column B.  
I have included a text\_input, a label and a search\_button. however, i have trouble creating the blocks for it. would appreciate if anyone could send some help.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/8/b801d48d85903133d3f675a78aa2ab259b8d4e6f.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [June 1, 2023, 3:22am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/2 "2023-06-01T03:22:26Z")

</div>

The way to do this is to use the `find first occurrence of` List block ([here](https://docs.thunkable.com/lists#find-first-last-occurrence)) with the `list of values` block (in [this section](https://docs.thunkable.com/data-sources#read) of the documentation) from your Data Source and assign that to a variable called something like foundRowNum.

Then Get Value from column B using foundRowNum as the row ID.

Here’s an example somewhat similar to what I mentioned: [Creating a search engine - #18 by tatiang](https://community.thunkable.com/t/creating-a-search-engine/2399004/18)

---

<div class="post-metadata">

**Author:** ![blvckrosesssppi](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blvckrosesssppi](https://community.thunkable.com/u/blvckrosesssppi)\
**Post date:** [June 1, 2023, 3:45am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/3 "2023-06-01T03:45:54Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/3/b33470aca185ede9f667db2a2176e9f8e11b8a1a.png)

im so sorry but how do i continue from here

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [June 1, 2023, 3:49am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/4 "2023-06-01T03:49:35Z")

</div>

Instead of using the `does list contain` block, use the `find first occurrence of` block.

You can see how to set that up in the link I provided above.

---

<div class="post-metadata">

**Author:** ![blvckrosesssppi](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blvckrosesssppi](https://community.thunkable.com/u/blvckrosesssppi)\
**Post date:** [June 1, 2023, 3:54am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/5 "2023-06-01T03:54:25Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/d/5dd019722d8ff2571139bc93f10bd8774856a285.png)  
is it something like this?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [June 1, 2023, 3:56am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/6 "2023-06-01T03:56:44Z")

</div>

That will search the column “Name” in your data source for the Text Input’s text and store the row number in `name1`. To then get the value from the same row, put `name1` into the “for row id” section of the `get value` block.

 ![Screenshot 2023-05-31 at 9.01.10 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/d/ed2cafbd7a51374c349959e8c0daca44c487d723.png)

---

<div class="post-metadata">

**Author:** ![blvckrosesssppi](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blvckrosesssppi](https://community.thunkable.com/u/blvckrosesssppi)\
**Post date:** [June 1, 2023, 4:03am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/7 "2023-06-01T04:03:18Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/8/188b0134bac602efb34943f25c3276a28b403275.png)

thank you so much. you are so good at this

---

<div class="post-metadata">

**Author:** ![blvckrosesssppi](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blvckrosesssppi](https://community.thunkable.com/u/blvckrosesssppi)\
**Post date:** [June 1, 2023, 5:16am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/8 "2023-06-01T05:16:45Z")

</div>

How should I do if the user enter a person that is not in my google sheets?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/5/f5a9ad53279b77cb2c9836fa448d3fb8b8ff9c61.png)  
But it doesnt work. pls advise

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [June 1, 2023, 12:29pm UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/9 "2023-06-01T12:29:01Z")

</div>

Avoid using the [gear list] block. The `list of values` block is already a list so you don’t need to use that extra list block.

 ![Screenshot 2023-06-01 at 5.27.17 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/3/d3f4f2160075425271088cf9cfd367f658e97d03.png)

---

<div class="post-metadata">

**Author:** ![blvckrosesssppi](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blvckrosesssppi](https://community.thunkable.com/u/blvckrosesssppi)\
**Post date:** [June 1, 2023, 3:09pm UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/10 "2023-06-01T15:09:13Z")

</div>

Thank you

---

<div class="post-metadata">

**Author:** ![blvckrosesssppi](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blvckrosesssppi](https://community.thunkable.com/u/blvckrosesssppi)\
**Post date:** [June 6, 2023, 2:23pm UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/11 "2023-06-06T14:23:59Z")

</div>

how do i modify the code such that when a name is entered, it would take the best out of the 3 readings.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/2/a2e57a5933f3c9a5baaf47f874bd7601f533e5aa.png)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/4/e432235c50d3e9ba634adc889cf7d59665712387.png)  
for example, if i search James, it would return 1.75.  
if i search Alan, it would return 5.75.  
however, if i search Mike who only has 1 reading, it will just give me 2.15 which is his most recent reading.

pls advise. thanks in advance

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [June 6, 2023, 2:46pm UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/12 "2023-06-06T14:46:43Z")

</div>

```auto
Set variable largestNum to 0
For j = 1 to number of rows in Data Source
      If Get value Name = target (e.g. "James")
         If Get value Final Timing > largestNum
            Set largestNum to Get value Final Timing

```

---

<div class="post-metadata">

**Author:** ![blvckrosesssppi](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blvckrosesssppi](https://community.thunkable.com/u/blvckrosesssppi)\
**Post date:** [June 7, 2023, 7:19am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/13 "2023-06-07T07:19:59Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/b/ab707d208b9df9fe0ee7992d4a072418ddb7986a.png)  
it doesnt work. am i doing it wrongly?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [June 7, 2023, 10:13am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/14 "2023-06-07T10:13:33Z")

</div>

See this demo: [Thunkable](https://x.thunkable.com/copy/b580e5ef981cc584172a353c41702015) (first screen)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/7/a7767593a1ffbfb6a9bbf02ca18217bd72674ac9.png)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/3/93a08221ffc2f944fd83a4a1f796deb2c3701deb.png)

---

<div class="post-metadata">

**Author:** ![blvckrosesssppi](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blvckrosesssppi](https://community.thunkable.com/u/blvckrosesssppi)\
**Post date:** [June 7, 2023, 10:44am UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/15 "2023-06-07T10:44:01Z")

</div>

thanks

by the way, is it possible to just search from the search bar directly instead of having a list? because if i have many people in my spreadsheet then it woould be difficult to go through the list itself

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [June 7, 2023, 2:09pm UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/16 "2023-06-07T14:09:06Z")

</div>

Sure, you can make the search function however you want. In the demo I created, I used the green “item” block that holds the name that the user clicked on. If you would rather have the user type in a name, just replace the “item” block with the text input’s text block.

---

<div class="post-metadata">

**Author:** ![blvckrosesssppi](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blvckrosesssppi](https://community.thunkable.com/u/blvckrosesssppi)\
**Post date:** [June 7, 2023, 4:30pm UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/17 "2023-06-07T16:30:14Z")

</div>

im sorry, not really good at this.

heres what i have:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/9/69c49878398563ad27128c4c0a43adec2d5f8960.png)  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/8/d8147b5fcc28771fcc7c45f37dec2ba53e5e7e4d.png)  
heres the link to my project  
[https://x.thunkable.com/copy/1d59b111e108aedc4a40706b7353aae5](https://x.thunkable.com/copy/1d59b111e108aedc4a40706b7353aae5)  
im stuck. i wanted to do a search function whereby i am able to get a value which corresponds to their name. also, such that when a name is entered, it would take the best out of the 3 readings. if i search James, it would return 1.75. if i search Alan, it would return 5.75. however, if i search Mike who only has 1 reading, it will just give me 2.15 which is his most recent reading. its nice to have a list to show the people i have but a search input would be good so that its easier to look up

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [June 7, 2023, 5:20pm UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/18 "2023-06-07T17:20:28Z")

</div>

If you’re looking for someone to help you code, you’re welcome to contact me privately and I can share details about my consulting service. But I’m not able to offer more here beyond what I’ve already set up for you. If it’s a quick question, then sure but this involves re-working some of the blocks and it’s time I don’t have right now.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [September 5, 2023, 5:20pm UTC](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/19 "2023-09-05T17:20:40Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
