Skip to Content
Excel Cookbook
book

Excel Cookbook

by Dawn Griffiths
May 2024
Intermediate to advanced
592 pages
13h 44m
English
O'Reilly Media, Inc.
Content preview from Excel Cookbook

Chapter 7. Array, Logic, and Lookup Functions

The recipes in this chapter cover three main areas that many types of spreadsheets require:

  • Manipulating arrays or ranges as part of a formula

  • Performing logical tests

  • Looking up values by name and index

The chapter includes filtering, sorting, and combining arrays using functions instead of menu commands; trapping and handling errors; choosing values to return based on a logical test or matching value; and using XLOOKUP, INDEX, and MATCH to look up values. It also covers ways of working with the INDIRECT and OFFSET functions to create dynamic references to cells and ranges.

7.1 Getting Unique Values

Problem

You have an array or range and want to retrieve a list of its unique values or the ones that appear exactly once.

Solution

Suppose A2:A6 lists customer first names, B2:B6 lists their last names, and you want to use this data to return two lists: one containing the unique names and another containing names that appear only once.

If you’re using Excel 2021 or Excel 365, you can solve this problem using the UNIQUE function to return a dynamic array of values. Generally, you use the formula =UNIQUE(array, by_column, exactly_once), where array is the range or array whose values you want to examine, by_column (optional) specifies whether you want to return unique rows or columns (omit it to return unique rows or set it to TRUE to return unique columns), and exactly_once (optional) specifies whether you want to return values ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft Excel 2021/365 - Beginner to Advanced

Microsoft Excel 2021/365 - Beginner to Advanced

Simon Sez IT
Microsoft Excel 365 Bible

Microsoft Excel 365 Bible

Michael Alexander, Dick Kusleika
Excel 2019 Bible

Excel 2019 Bible

Michael Alexander, Richard Kusleika, John Walkenbach

Publisher Resources

ISBN: 9781098143312Errata PageSupplemental Content