# If A1 is present in column B, get C. How do I make it?

**URL:** <https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463>\
**Category:** Ask for Help\
**Created:** [December 29, 2020, 8:01pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463 "2020-12-29T20:01:15Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaxB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maxb/32/15623_2.png) [@MaxB](https://community.glideapps.com/u/MaxB)\
**Post date:** [December 29, 2020, 8:01pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/1 "2020-12-29T20:01:15Z")

</div>

I have “Car” in a sheet, on another sheet I have two columns with “Vehicle” (Car, Bike, Train, etc) and one list with “Wheels” (4, 2, 34, etc).

I’d like the sheet to give me 4 in the cell next to “Car”.

I’m new to sheets. Thanks if you will help. Happy holidays.

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [December 29, 2020, 8:08pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/2 "2020-12-29T20:08:11Z")

</div>

You could do that with a vlookup

---

<div class="post-metadata">

**Author:** ![Nadir\_Abdelrahman\_MD](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nadir_abdelrahman_md/32/5237_2.png) [@Nadir\_Abdelrahman\_MD](https://community.glideapps.com/u/Nadir_Abdelrahman_MD)\
**Post date:** [December 29, 2020, 8:13pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/3 "2020-12-29T20:13:09Z")

</div>

If you have header in line 1.  
Use this method - in cell b2:  
=arrayformula(if(a2:a\<\>"","",c2:c))

---

<div class="post-metadata">

**Author:** ![MaxB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maxb/32/15623_2.png) [@MaxB](https://community.glideapps.com/u/MaxB)\
**Post date:** [December 29, 2020, 8:23pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/4 "2020-12-29T20:23:29Z")

</div>

They are not in the same sheet so the correspondant of A2 in one sheet could be B16 and not B2

> [@Eric\_Penn](#):
>
> You could do that with a vlookup

in sheets? How?

---

<div class="post-metadata">

**Author:** ![Nadir\_Abdelrahman\_MD](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nadir_abdelrahman_md/32/5237_2.png) [@Nadir\_Abdelrahman\_MD](https://community.glideapps.com/u/Nadir_Abdelrahman_MD)\
**Post date:** [December 29, 2020, 8:27pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/5 "2020-12-29T20:27:33Z")

</div>

Can share a screenshot? Please

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [December 29, 2020, 8:27pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/6 "2020-12-29T20:27:50Z")

</div>

replace with…

YourSheetName!C2:C

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [December 29, 2020, 8:33pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/7 "2020-12-29T20:33:53Z")

</div>

I actually learned a great deal from this post by @ThinhDinh

There are some really great tips in here and best practices to follow.

> [@Tutorial: Arrayformula in Google Sheets, good practices & how to overcome Arrayformula restrictions with scripts](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727):
>
> Hi, Today I will show you the script that can make copying formulas down work, when it does not work with arrayformula. But first, let’s have some introductions about arrayformula, for those who has not used this before in Google Sheets, some equivalents in Glide and some good practices while using it. I hope it can help you in building your Glide apps as well as applying it in your normal day job. 
> 
> > **1/ Definition**
> >
> > Arrayformula is defined as “a range, mathematical expression using one cell range …

---

<div class="post-metadata">

**Author:** ![MaxB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maxb/32/15623_2.png) [@MaxB](https://community.glideapps.com/u/MaxB)\
**Post date:** [December 29, 2020, 8:42pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/8 "2020-12-29T20:42:38Z")

</div>

Vlookup worked, thanks.

Should arrayformula have worked too?

---

<div class="post-metadata">

**Author:** ![MaxB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maxb/32/15623_2.png) [@MaxB](https://community.glideapps.com/u/MaxB)\
**Post date:** [December 29, 2020, 8:45pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/9 "2020-12-29T20:45:17Z")

</div>

Since I’m here, how do I apply a formula to the whole columns including future new rows?

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [December 29, 2020, 8:49pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/10 "2020-12-29T20:49:14Z")

</div>

Here is an example with the formula starting in the header row.

```
={"Yourheaderhere";arrayformula(iferror(VLOOKUP(A2:A,NamedRange,2,false),""))}

```

Note: Don’t forget the } at the end of the formula 🕶

---

<div class="post-metadata">

**Author:** ![MaxB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maxb/32/15623_2.png) [@MaxB](https://community.glideapps.com/u/MaxB)\
**Post date:** [December 29, 2020, 9:04pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/11 "2020-12-29T21:04:18Z")

</div>

Thx a lot, it works.

So arrayformula is a powerful magic i suppose…

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [December 29, 2020, 9:16pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/12 "2020-12-29T21:16:41Z")

</div>

That’s great! I’m glad I could help you and Happy Holidays to you too!

Yes the array formula is very powerful. It’s always best to start in the header rows and to use iferror or if(isblank type logic when building your formulas.

---

<div class="post-metadata">

**Author:** ![MaxB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maxb/32/15623_2.png) [@MaxB](https://community.glideapps.com/u/MaxB)\
**Post date:** [December 29, 2020, 9:24pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/13 "2020-12-29T21:24:42Z")

</div>

I’m now trying other formulas I need to apply to whole columns but it only does it for the first row:  
={“Header”;arrayformula(iferror(JOIN(" - “;G2;E2;F2;W2;O2;C2;D2);”"))}  
If I add the G2:G; etc, i get all the joins in one cell.

However, it’s late here, and these things are mind energy expensive ^^ thx again, to the next one!

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [December 29, 2020, 9:45pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/14 "2020-12-29T21:45:50Z")

</div>

Maybe try to use _concatenate_ function instead?..this is a little above my pay grade 😜

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [December 29, 2020, 9:47pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/15 "2020-12-29T21:47:35Z")

</div>

Is there any reason for not doing any of this within the Glide data editor with relations, lookups, templates, etc?

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [December 29, 2020, 9:48pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/16 "2020-12-29T21:48:54Z")

</div>

The only reason I ever use vlookups is for data sets that have too many rows for us to attach to glide.

Other than that Jeff makes a good point here.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [December 30, 2020, 1:00am UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/17 "2020-12-30T01:00:59Z")

</div>

> [@MaxB](#):
>
> ={“Header”;arrayformula(iferror(JOIN(" - “;G2;E2;F2;W2;O2;C2;D2);”"))}

Seems like it should be

```
={“Header”;arrayformula(IF(A2:A="";"";G2:G&" - "&E2:E&" - "&F2:F&" - "&W2:W&" - "&O2:O&" - "&C2:C&" - "&D2:D))}

```

---

<div class="post-metadata">

**Author:** ![MaxB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maxb/32/15623_2.png) [@MaxB](https://community.glideapps.com/u/MaxB)\
**Post date:** [December 30, 2020, 2:51pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/18 "2020-12-30T14:51:08Z")

</div>

I thought I wanted to keep the data in sheets, and learn how to do it if I’d need it, and I thought I might have needed additional columns in glide, and I have way too many.

And, most of all, I can’t convert a normal column into a glide column, so now if I want to use the newly made one, I will have to manually go and change it in ALL of the parts of the app that use that column, can you confirm that for me or is there a way to save me from this?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [December 30, 2020, 6:02pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/19 "2020-12-30T18:02:40Z")

</div>

No, that’s fine. There’s nothing wrong with doing any of that in the google sheet if you need it there and that’s what you prefer. I just wanted to make sure that you were aware of the option.

In my opinion, setting some of that stuff up with Glide columns is easier, more flexible, and future proof compare to writing formulas. Also glide columns will give you instant results instead of waiting for data to sync from the app to the glide servers, then to the sheet, run through the formulas, then sync back to the glide servers, then finally sync back to the app. It’s usually only a few seconds, but it’s not instant like glides computed columns which happen directly on the device itself. It’s just better to consider your options sooner rather than later when your app gets larger and more complex.

My app was built before there was even a glide data editor, so a lot of it originally used a lot of arrayformulas, queries, and other google sheet logic. I’ve slowly been converting to glides computed columns, which has sped things up a lot, but it’s very tedious to switch components over to new columns. So, I understand if you don’t want to mess with any logic you already have in place.

Again, just making sure you were aware of the option.

---

<div class="post-metadata">

**Author:** ![MaxB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maxb/32/15623_2.png) [@MaxB](https://community.glideapps.com/u/MaxB)\
**Post date:** [December 30, 2020, 7:45pm UTC](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463/20 "2020-12-30T19:45:28Z")

</div>

Ok, thx for the information, that’s appreciated.  
Will keep that in mind.

[Next page](https://community.glideapps.com/t/if-a1-is-present-in-column-b-get-c-how-do-i-make-it/20463.md?page=2)
