Using form Variables in Custom Spreadsheet Formulas?

Hello, I am interested in setting up a custom formula for my spreadsheet. For instance, I would like to use the formula “=VLOOKUP(C7, Client!$A:$L, 10, FALSE)” in the “Total price excl. VAT” section. However, I would like to replace “C7” with the “Client code” variable from my form used for adding an item. Is it feasible to utilize form variables in the “Custom” section? Thank you for your assistance.

That sounds like a use case for a combination of relation & lookup.

In your destination table, create a relation linking the client code with the right column in the Client table. Don’t click the “match multiple” box.

Use a lookup on top of that relation to retrieve the column you want.

1 Like

Thank you for your suggestion! I actually found a solution that works really well for me. I used the method described in the Glide documentation here: ARRAYFORMULA | Glide Docs. It’s a combination of ARRAYFORMULA, VLOOKUP, and IFERROR to dynamically populate the rows.

However, I encountered a small issue where the application creates two rows in my spreadsheet when I submit the form. Do you have any suggestions on how to ensure it only creates one row?

Thank you for your help!

That’s because you have an onSubmit action that Adds a Row.
So when your form is submitted, a row is added. And then your onSubmit action adds a second row.
You need to get rid of that onSubmit action.

I’d also encourage you to have a closer look at what @ThinhDinh said earlier…

The above is a much better approach than messing around with GSheet formulas. As a general rule, you don’t need any GSheet formulas when working with Glide (except in very rare cases). The Glide Data Editor has all the capability that you’re ever likely to need, and your App will perform much better if you avoid GSheet formulas.

2 Likes

However, I don’t see how to delete this OnSubmit action. Because it’s a button connected to a Data Grid.
Capture d'écran 2024-02-25 155532

Thank you very much :+1: