Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is a custom function in Google Sheets?
A custom function is a special formula you create yourself using Google Apps Script to do tasks that built-in functions can't do.
Click to reveal answer
beginner
How do you start writing a custom function in Google Sheets?
Open the Extensions menu, choose Apps Script, then write a JavaScript function that starts with the keyword function and returns a value.
Click to reveal answer
beginner
What must a custom function always do to work correctly in a cell?
It must return a value. The returned value is what you see in the cell where you use the function.
Click to reveal answer
intermediate
Can custom functions in Google Sheets change other cells or the spreadsheet structure?
No, custom functions can only return values to the cell they are called from. They cannot change other cells or the sheet layout.
Click to reveal answer
beginner
How do you use a custom function once it is created?
Just type its name like a normal formula in a cell, for example =MYFUNCTION(A1), and it will run and show the result.
Click to reveal answer
Where do you write a custom function for Google Sheets?
ADirectly in a cell
BIn the Extensions > Apps Script editor
CIn the Google Docs document
DIn the Google Drive settings
✗ Incorrect
Custom functions are written in the Apps Script editor accessed from Extensions > Apps Script.
What must a custom function always do to work properly?
AReturn a value
BChange other cells
CSend an email
DOpen a popup window
✗ Incorrect
Custom functions must return a value to display in the cell where they are used.
Can a custom function modify other cells in the spreadsheet?
AYes, always
BOnly if you have admin rights
CNo, never
DOnly on weekends
✗ Incorrect
Custom functions cannot change other cells or the spreadsheet layout.
How do you call a custom function in a sheet cell?
ABy typing its name with an equal sign, like =MYFUNC()
BBy clicking a button in the toolbar
CBy right-clicking the cell
DBy opening the script editor
✗ Incorrect
You use custom functions just like built-in ones, starting with = and the function name.
Which language do you use to write custom functions in Google Sheets?
AHTML
BPython
CSQL
DJavaScript
✗ Incorrect
Google Sheets custom functions are written in JavaScript using Google Apps Script.
Explain how to create and use a custom function in Google Sheets.
Think about the steps from writing code to using it in a cell.
You got /4 concepts.
What are the limitations of custom functions in Google Sheets?
Focus on what custom functions cannot do compared to scripts.
You got /4 concepts.
Practice
(1/5)
1. What is a custom function in Google Sheets?
easy
A. A chart type you add to your sheet
B. A built-in formula like SUM or AVERAGE
C. A filter to sort data automatically
D. A formula you create using JavaScript in Google Apps Script
Solution
Step 1: Understand what custom functions are
Custom functions are formulas you write yourself using JavaScript in Google Apps Script.
Step 2: Differentiate from built-in features
Built-in formulas like SUM are pre-made, while custom functions are user-created.
Final Answer:
A formula you create using JavaScript in Google Apps Script -> Option D
Quick Check:
Custom function = user-made JavaScript formula [OK]
Hint: Custom functions are your own formulas written in JavaScript [OK]
Common Mistakes:
Confusing custom functions with built-in formulas
Thinking custom functions are chart types
Believing custom functions are filters
2. Which of the following is the correct way to start defining a custom function in Google Apps Script?
easy
A. function MYFUNCTION() { return 'Hello'; }
B. def MYFUNCTION() { return 'Hello'; }
C. func MYFUNCTION() { return 'Hello'; }
D. function: MYFUNCTION() { return 'Hello'; }
Solution
Step 1: Recall JavaScript function syntax
In Google Apps Script, which uses JavaScript, functions start with the keyword 'function' followed by the name and parentheses.
Step 2: Check each option's syntax
function MYFUNCTION() { return 'Hello'; } uses correct JavaScript syntax. Options B and C use Python or other language syntax. function: MYFUNCTION() { return 'Hello'; } has incorrect punctuation.
Final Answer:
function MYFUNCTION() { return 'Hello'; } -> Option A
Quick Check:
JavaScript function syntax = function MYFUNCTION() { return 'Hello'; } [OK]
Hint: JavaScript functions start with 'function' keyword [OK]
Common Mistakes:
Using Python or other language syntax
Adding colons after function name
Missing parentheses after function name
3. Given this custom function code in Google Apps Script:
function DOUBLE(input) {
return input * 2;
}
What will be the result of =DOUBLE(5) in a sheet cell?
medium
A. 5
B. DOUBLE(5)
C. 10
D. Error
Solution
Step 1: Understand the function logic
The function takes an input and returns input multiplied by 2.
Step 2: Calculate the output for input 5
5 multiplied by 2 equals 10.
Final Answer:
10 -> Option C
Quick Check:
5 * 2 = 10 [OK]
Hint: Multiply input by 2 to get output [OK]
Common Mistakes:
Expecting the function name as output
Thinking it returns input unchanged
Assuming syntax error without checking code
4. You wrote this custom function:
function ADDTEN(value) {
return value + 10
}
But when you use =ADDTEN(5) in the sheet, it shows an error. What is the likely problem?
medium
A. Function name must be lowercase
B. Missing closing brace '}'
C. Function lacks parentheses
D. Missing semicolon after return statement
Solution
Step 1: Check the function syntax carefully
The function code is missing the closing brace '}' at the end.
Step 2: Understand impact of missing brace
Without the closing brace, the script is incomplete and causes an error when called.
Final Answer:
Missing closing brace '}' -> Option B
Quick Check:
All functions need matching braces [OK]
Hint: Always close function with a brace '}' [OK]
Common Mistakes:
Thinking semicolon is mandatory in Apps Script
Assuming function name case matters
Overlooking missing braces
5. You want a custom function that takes a range of numbers and returns the sum of only the positive numbers. Which of these custom functions will work correctly?
hard
A. function SUMPOS(range) {
let total = 0;
for (let i = 0; i < range.length; i++) {
if (range[i][0] > 0) total += range[i][0];
}
return total;
}
B. function SUMPOS(range) {
return range.reduce((a,b) => a + b);
}
C. function SUMPOS(range) {
let total = 0;
for (let i in range) {
if (range[i] < 0) total += range[i];
}
return total;
}
D. function SUMPOS(range) {
return Math.sum(range);
}
Solution
Step 1: Analyze each function's logic
function SUMPOS(range) {
let total = 0;
for (let i = 0; i < range.length; i++) {
if (range[i][0] > 0) total += range[i][0];
}
return total;
} loops through the range and adds only positive numbers. function SUMPOS(range) {
return range.reduce((a,b) => a + b);
} sums all numbers without filtering. function SUMPOS(range) {
let total = 0;
for (let i in range) {
if (range[i] < 0) total += range[i];
}
return total;
} adds negative numbers only. function SUMPOS(range) {
return Math.sum(range);
} uses a non-existent Math.sum function.
Step 2: Identify correct filtering and summing
Only function SUMPOS(range) {
let total = 0;
for (let i = 0; i < range.length; i++) {
if (range[i][0] > 0) total += range[i][0];
}
return total;
} correctly filters positive numbers and sums them.
Final Answer:
The function that sums only positive numbers -> Option A