How to Create Named Functions in Google Sheets

Published on

Named functions are user-created, reusable formulas within a Google Sheet. You can use them across all sheets in the same workbook where they are saved. To use a named function in a different spreadsheet, you can either recreate it manually or import it from a workbook where it already exists.

Named functions behave like built-in formulas: as you type the function name, Google Sheets shows it in the formula list and provides formula help. The efficiency of the function depends on the formula you define.

Formula help window of a named function in Google Sheets

Custom Named Functions vs. Unnamed Functions

When we talk about custom named functions, it’s useful to contrast them with unnamed functions:

  • Named functions: Created through the Google Sheets menu with placeholder arguments, reusable anywhere in the workbook.
  • Unnamed functions: Functions without a name, created using the LAMBDA function.

Example of a Named Function

SEQUENCE_NB(column_ref_1) is a named function that returns sequence numbers corresponding to non-empty cells in another column. We will create this function later in the tutorial.

=SEQUENCE_NB(D2:D)
Example of SEQUENCE_NB()

Place this in row 2 of any empty column (e.g., F2) to get sequence numbers corresponding to non-blank cells in column D.

You can reuse it across the workbook like any built-in function:

=SEQUENCE_NB(A2:A) =SEQUENCE_NB(Sheet2!I:I)

Equivalent Unnamed Function

The same logic can be implemented with a LAMBDA function:

=LAMBDA(column_ref_1, ArrayFormula(IF(LEN(column_ref_1), COUNTIFS(ROW(column_ref_1), "<="&ROW(column_ref_1), LEN(column_ref_1), ">0"), "")))(D2:D)

Or directly as a formula:

=ArrayFormula(IF(LEN(D2:D), COUNTIFS(ROW(D2:D), "<="&ROW(D2:D), LEN(D2:D), ">0"), ""))

Key Difference:

  • Unnamed function: Created using the LAMBDA function, these are often used as helper functions with BYROW, BYCOL, SCAN, REDUCE, MAP, or MAKEARRAY. Placeholders like column_ref_1 are defined within the LAMBDA itself.
  • Named function: Placeholders are defined using the Named Functions menu, making reuse easier without typing the full formula.

When to Consider Creating a Named Function

Named functions are especially useful when:

  • You need to reuse complex formulas multiple times in a sheet or workbook.
  • You want to simplify formulas for team members or collaborators.
  • You need to standardize calculations across multiple sheets or reports.

How Named Functions Differ in Excel and Google Sheets

Excel: You first convert a formula to a LAMBDA function, then define it in Name Manager.

Google Sheets: You don’t need to write a LAMBDA first.

  • Copy your working formula.
  • Go to Data > Named functions.
  • Replace cell/range references with meaningful placeholders (text) for inputs.

Example: Replace A2:A with column_reference.

How to Create a Named Function in Google Sheets

We’ll create two examples to demonstrate how to convert formulas into named functions: SEQUENCE_NB (one argument) and FLIP_DATA (two arguments).

Example 1: SEQUENCE_NB (One Argument)

This function returns sequential numbers corresponding to non-empty cells in a column.

Formula:

=ArrayFormula(IF(LEN(D2:D), COUNTIFS(ROW(D2:D), "<="&ROW(D2:D), LEN(D2:D), ">0"), ""))

Creating the named function:

  1. Copy the formula.
  2. Go to Data > Named functions > Add new function.
  3. Name the function: SEQUENCE_NB. Avoid:
    • Built-in function names
    • TRUE/FALSE
    • A1 or R1C1 references
    • Spaces or special characters (except underscore)
    • Names starting with a number
    • Overly long names (>255 characters)
  4. Add a description: “Returns the sequence of values in a column skipping blanks.”
  5. Add the argument placeholder: column_ref_1 (don’t forget to click the ↵ Enter icon).
  6. Paste the formula and replace D2:D with the placeholder:
=ArrayFormula(IF(LEN(column_ref_1), COUNTIFS(ROW(column_ref_1), "<="&ROW(column_ref_1), LEN(column_ref_1), ">0"), ""))
Named Functions sidebar panel page 1 in Google Sheets
  1. Click Next, fill in the argument description and example reference (e.g., B2:B10), then click Create.
Named Functions sidebar panel page 2 in Google Sheets

You can now reuse SEQUENCE_NB anywhere in the workbook, just like a built-in function:

=SEQUENCE_NB(A2:A) =SEQUENCE_NB(Sheet2!I:I)

Example 2: FLIP_DATA (Two Arguments)

This function flips a data range vertically.

Formula:

=SORT(A2:C5, ROW(A2:A5)*N(A2:A5<>""), 0)

Creating the named function:

The process is the same as in Example 1. Key differences:

  • Function name: FLIP_DATA
  • Description: “Given a range, returns a vertically flipped data range.”
  • Argument placeholders:
    • flip_range → the range to flip
    • first_col_range → the first column used for sorting
  • Copy and paste the formula, then replace the cell references in the formula with placeholders:
=SORT(flip_range, ROW(first_col_range)*N(first_col_range<>""), 0)
  • Click Next and optionally enter example values: A2:C5 for flip_range and A2:A5 for first_col_range.

Click Create, and the named function is ready to use across the workbook.

Example of FLIP_DATA

How to Delete or Modify Named Functions

  1. Go to Data > Named functions.
  2. Click the three dots next to a function.
  3. Choose Edit or Remove.

Note: You cannot delete multiple named functions at once.

Importing Named Functions from Another Workbook

  1. Create all required named functions in a source sheet.
  2. Open the destination Google Sheet.
  3. Go to Data > Named functions > Import function.
  4. Select the file containing your named functions.
  5. Click Import All or select specific functions to import.
Import Named Functions window in Google Sheets

Now the imported named functions are available for use within this destination workbook.

Get My Ready-Made Named Functions in Google Sheets

Conclusion

Creating named functions in Google Sheets streamlines your workflow, reduces errors, and allows complex formulas to be reused easily across your workbook. With a few steps, you can turn any formula into a reusable tool, import it across workbooks, and simplify data management tasks.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Top Discussions

Reservation and Booking Status Calendar Template in Google Sheets

My reservation and booking status calendar template in Google Sheets uses spreadsheet cells as rooms and highlighting to show availability/non-availability. I have used a few...
Multi Row Dynamic Dependent Drop-Down List in Google Sheets

Multi-Row Dynamic Dependent Drop-Down List in Google Sheets

We can create a multi-row dynamic dependent drop-down list in Google Sheets without using Google Apps Script. This tutorial explains how. I will only use...

Date-Related Conditional Formatting Rules in Google Sheets

Based on my experience, much of the conditional formatting in Google Sheets centers around dates. Therefore, in this tutorial, I've included several date-related conditional...
Populate info in Spreadsheet

Auto-Populate Information Based on Drop-down Selection in Google Sheets

Another awesome Google Sheets tutorial! This time, we'll learn how to auto-populate information based on a drop-down selection. Spreadsheet applications are always enticing to me....
USAGE OF DATE IN QUERY SYNTAX

How to Use Date Criteria in Query Function in Google Sheets [Date in Where...

Using dates as the criteria are a complicated part of any criteria formation in the Google Sheet functions. In most cases, you can not...

More like this

Rental Property Manager Template for Google Sheets (Free & Fully Automated)

Do you want to manage all aspects of your rental properties, such as tracking...

Content Calendar Template in Google Sheets (Free, Dynamic & Fully Automated)

Are you a content creator managing posts across multiple platforms — Blogs, YouTube, Twitter...

Funnel Chart in Google Sheets (Dynamic without Helper Columns)

Most tutorials online create a funnel chart in Google Sheets using a stacked bar...

LEAVE A REPLY

This site uses Akismet to reduce spam. Learn how your comment data is processed.