# How to search with an input in the entire column instead of the row

**URL:** <https://community.glideapps.com/t/how-to-search-with-an-input-in-the-entire-column-instead-of-the-row/60465>\
**Category:** Ask for Help\
**Created:** [April 13, 2023, 6:15am UTC](https://community.glideapps.com/t/how-to-search-with-an-input-in-the-entire-column-instead-of-the-row/60465 "2023-04-13T06:15:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucas\_Soares](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_soares/32/56289_2.png) [@Lucas\_Soares](https://community.glideapps.com/u/Lucas_Soares)\
**Post date:** [April 13, 2023, 6:15am UTC](https://community.glideapps.com/t/how-to-search-with-an-input-in-the-entire-column-instead-of-the-row/60465/1 "2023-04-13T06:15:26Z")

</div>

Hello community, I need help with a logic, I am learning about Glide and have made great progress, but I am stuck in this context:

I have a search to be done in a table, this table has the following composition:

 ![Captura de Tela 2023-04-13 às 03.14.08](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/3/03637fccf05b504f0ea33851bb46620f7fa062fa.jpeg)

Context:

- The idea is to have a text entry (input) where I will enter the CNPJ (number)
- If the input is not found, that is, the entered CNPJ is not equal to any CNPJ in the database, I will return = Available client for negotiation.
- If the input is found, that is, the entered CNPJ is equal to some CNPJ that is already in the database, I need to make another verification in the Status column.
- If the CNPJ is found, I search the status column that can have two statuses: lost or won.
- If the status is = lost, I will return = Lost client, available for negotiation.
- If the status is = won, I will return = Already our client.

Google Sheets Formula:

- I used the following formula in GS and it worked smoothly:

```auto
=IF(ISBLANK(G2),"",IFERROR(IF(VLOOKUP(G2,API!A:E,3,FALSE)="won","Already our client";IF(VLOOKUP(G2,API!A:E,3,FALSE)="lost","Lost client, available for negotiation")),"Available for negotiation"))

```

Attempts:

- I tried to use the logic in GS, but there are 40,000 CNPJs, which makes the search very slow (discarded).
- I tried to use a search logic (input) + IF-THEN-ELSE column, but the input seems to search line by line and not the entire column, if you know how to do this.
- I tried to use common lookups, but I did not know how to relate the first CNPJ search with the conditions in case the CNPJ is found and I need to verify the status.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 13, 2023, 6:50am UTC](https://community.glideapps.com/t/how-to-search-with-an-input-in-the-entire-column-instead-of-the-row/60465/2 "2023-04-13T06:50:09Z")

</div>

I would do it something like this:

- Create a separate single row table to use as the source for your query input
- Add a RowID column to that table, and a User Specific Text column to accept your Text Input (CNPJ value)
- Create a single relation column that matches the entered CNPJ value with the CNPJ column in your data table
- Add a Lookup column that fetches the Status value via the Relation column
- Finally, add an if-then-else column using the following:  
– If Relation column is empty, then ‘Available client for negotiation’  
– If Lookup column is lost, then ‘Lost client, available for negotiation’  
– If Lookup column is won, then ‘Already our client’

---

<div class="post-metadata">

**Author:** ![Lucas\_Soares](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_soares/32/56289_2.png) [@Lucas\_Soares](https://community.glideapps.com/u/Lucas_Soares)\
**Post date:** [April 14, 2023, 6:23pm UTC](https://community.glideapps.com/t/how-to-search-with-an-input-in-the-entire-column-instead-of-the-row/60465/3 "2023-04-14T18:23:14Z")

</div>

Hey @Darren_Murphy , it perfectly solved what I needed, I really appreciate the help the glide community has been incredible in this process of learning with the tool. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [April 15, 2023, 6:23pm UTC](https://community.glideapps.com/t/how-to-search-with-an-input-in-the-entire-column-instead-of-the-row/60465/4 "2023-04-15T18:23:51Z")

</div>

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