Returns the first non-blank value in a range
=IFERROR(
INDEX(FILTER(values, LEN(TO_TEXT(values))), 1),
""
)This function returns the first non-blank value from a range, scanning left-to-right and top-to-bottom. It's useful when you have several possible fields (preferred name, fallback name, override values, etc.) and want the first one that actually contains data. For example, if A2:C2 contains "", "Keshia", "Unknown", then =COALESCE(A2:C2) returns "Keshia".
Use the inputs below to create COALESCE as a reusable custom function in Google Sheets.
Learn how to add custom functions to Google SheetsCOALESCE
Returns the first non-blank value in a range
=IFERROR( INDEX(FILTER(values, LEN(TO_TEXT(values))), 1), "" )
values
Range of values to scan for the first non-blank
A2:C2
Other functions in the same category: List & Array Operations
Compare two ranges and list the elements that are in the first but not in the second
Concatenates multiple ranges or arrays and removes duplicates
Return the top N items ranked by scores
Return the botttom N items ranked by scores
Extract a list of unique values from a range
Named functions enable the creation of custom, reusable formulas that mimic built-in functions, streamlining calculations and data manipulations. These functions simplify complex formulas, making spreadsheets more readable and less prone to errors. By encapsulating intricate logic within a single function call, they enhance consistency across your data. Utilizing named functions reduces the need to write lengthy formulas repeatedly, thereby improving workflow efficiency and productivity in data analysis and management.
Download and import — fastest way to add the function but does not include argument descriptions and examples
Follow these simple steps to download and import a function into your spreadsheet. This method is the quickest and easiest way to add the named function to your Google Sheets document, but will not include the argument description and examples.
Once added, the function will be ready to use in your document like any other built-in function. Simply type the function name and provide the required inputs to use it in your calculations.
Copy and paste — copy and paste each property one at a time
Follow these simple steps to integrate a custom named function into your spreadsheet:
Once added, the function will be ready to use in your document like any other built-in function. Simply type the function name and provide the required inputs to use it in your calculations.