learn how to add autofill formulas with google form responses in google sheets. the cell values are automatically calculated when a new google form response is submitted.

when people submit your google form, a new row is inserted in the google sheet that is storing the form responses. this spreadsheet row contains a timestamp column, the actual date when the form was submitted, and the other columns in the sheet contain all the user’s answers, one per column.

you can extend the google forms sheet to also include formula fields and the cell values are automatically calculated whenever a new row is added to the sheet by the google form. for instance:

- You can have an auto-number formula that assigns an auto-incrementing but sequential ID to every form response. It can be useful when you are using Google Forms for .
- For customer order forms, a formula can be written in Google Sheets to calculate the total amount based on the item selection, the country (tax rates are different) and the quantity selected in the form.
- For hotel reservations forms, a formula can automatically calculate the room rent based on the check-in and check-out date filled by the customer in the Google Form.
- For quizzes, a teacher can automatically calculate the final score of the student by matching the values entered in the form with the actual answers and assigning scores.
- If a users has made multiple form submissions, a formula can help you determine the total number of entries made by a user as soon as they submit a form.

### Google Sheets Formulas for Google Forms

手机赌博appin this step by step guide, you’ll learn how to add formulas to google sheets that are associated with google forms. the corresponding cell values in the response rows will be automatically calculated when a new response is submitted.

to get a better understanding of what we are trying to achieve, open this and submit a response. next, open this and you’ll find your response in a new row. the columns f-k are autofilled using formulas.

All examples below will use the ArrayFormula function of Google Sheets though some of these example can also be written using the `FILTER`

function.

#### Auto-Number Form Responses with a Unique ID

手机赌博appopen the google sheet that is storing form responses, go to first empty column and copy-paste the following formula in the row #1 of the empty column.

```
=ArrayFormula(
IFS(
ROW(A:A)=1, "Invoice ID",
LEN(A:A)=0, IFERROR(1/0),
LEN(A:A)>0, LEFT(CONCAT(REPT("0",5), ROW(A:A) -1),6)
)
)
```

The `ROW()`

function returns the row number of the current response row. It returns `1`

手机赌博app for the first row in the Invoice Column and thus we set the column title in the first row. For subsequent rows, if the first column of the row (usually Timestamp) is not empty, the invoice ID is auto generated.

The IDs will be like `00001`

, `00002`

and so on. You only need to place the formula is first row of the column and it auto-populates all the other rows in the column.

The `IFERROR`

function returns the first argument if it is not an error value, otherwise returns the second argument if present, or a blank if the second argument is absent. So in this case `1/0`

手机赌博app is an error and thus it always returns a blank value.

#### Date Calculation Formula for Google Forms

your google form has two date fields - the check-in date and the check-out date. the hotel rates may vary every season so you have a separate table in the google sheet that maintains the room rent per month.

the column c in the google sheet holds the responses for the check-in date while the d column is storing the check-out dates.

```
=ArrayFormula(
IF(ROW(A:A) = 1,
"Room Rent",
IF(NOT(ISBLANK(A:A)),
(D:D - C:C) *
VLOOKUP(MONTH(D:D), 'Room Rates'!$B$2:$C$13,2, TRUE),
""
)
)
)
```

The formulas uses `VLOOKUP`

to get the room rates for the travel date specified in the form response and then calculates the room rent by multiplying the room rent with duration of stay.

The same formula can also be written with `IFS`

instead of `VLOOKUP`

```
=ArrayFormula(
IF(ROW(A:A) = 1,
"Room Rent",
IFS(ISBLANK(C:C), "",
MONTH(C:C) < 2, 299,
MONTH(C:C) < 5, 499,
MONTH(C:C) < 9, 699,
TRUE, 199
)
)
)
```

#### Calculate Tax Amount Based on Invoice Value

In this approach, we’ll use the `FILTER`

function and that could lead to a less complicated formula than using using `IF`

手机赌博app function. The downside is that you have to write the column title in row #1 and paste the formulas in row #2 (so one form response should exist for the formula to work).

`=ArrayFormula(FILTER(E2:E, E2:E<>"")*1.35)`

here we apply 35% tax to the invoice value and this formula should be added in the row #2 of the column titled “tax amount” as shown in the screenshot.

#### Assign Quiz Scores in Google Forms

手机赌博appwhich city is known as the big apple? this is a short-answer question in google forms so students can give responses like new york, new york city, nyc and they’ll still be correct. the teacher has to assign 10 points to the correct answer.

```
=ArrayFormula(
IF(ROW(A:A) = 1,
"Quiz Score",
IFS(
ISBLANK(A:A), "",
REGEXMATCH(LOWER({B:B}), "new\s?york"), 10,
{B:B} = "NYC", 10,
TRUE, 0
)
)
)
```

In this formula, we are making use of the `IFS`

function that like an `IF THEN`

statement in programming. We are using `REGEXMATCH`

to match values like `New York, New York, newyork`

in one go using regular expressions.

The `IFS`

function returns an `NA`

if none of the conditions are true so we add a `TRUE`

check at the end that will always be evaluated to `true`

if none of the previous conditions matched and returns `0`

.

#### Extract the First Name of the Form Respondent

If you have form field that asks the user to entire their full name, you can use Google Sheets function to extract the first name from the full name and use that field to send personalised emails.

```
=ArrayFormula(
IFS(
ROW(A:A)=1, "First Name",
LEN(A:A)=0, IFERROR(1/0),
LEN(A:A)>0, PROPER(REGEXEXTRACT(B:B, "^[^\s+]+"))
)
)
```

We’ve used `RegexExtract`

method here to fetch the string before the first space in the name field. The `PROPER`

function will capitalise the first letter of the name incase the user entered their name in lower case.

#### Find Duplicate Google Form Submissions

手机赌博appif your google form is collection email addresses, you can use that field to quickly detect responses that have been submitted by the same user multiple times.

```
=ArrayFormula(
IFS(
ROW(A:A)=1, "Is Duplicate Entry?",
LEN(A:A)=0, IFERROR(1/0),
LEN(A:A)>0, IF(COUNTIF(B:B, B:B) > 1, "YES", "")
)
)
```

Assuming that the Column B is storing the email addresses of the form respondents, we can use the `COUNTIF`

function to quickly mark duplicate entries in our responses spreadsheet. You can also use conditional formatting in Sheets to highlight rows that are possible duplicate entries.

#### Email Form Responses with AutoFill Values

You can use to automatically send an email to the form respondents. The email is sent after the formular values are auto-filled by the Google Sheet. The original form response and the calculated values can also be included in the generated PDF document.