How to use the AREAS function
What is the AREAS function?
The AREAS function returns the number of cell ranges and single cells in the specified argument.
Table of Contents
1. Introduction
What is a cell reference?
A cell reference in Excel is a way to identify and refer to a specific cell or range of cells within a spreadsheet. Cell references are fundamental to Excel's functionality, allowing users to create dynamic, interconnected spreadsheets.
What is the cell reference structure?
It depends if the cell reference points to a single cell or a cell range containing multiple cells. A single cell reference typically consists of a column letter followed by a row number (e.g., A1, B2, C3).
A cell range reference points to multiple cells, for example: A1:B10. Note that the colon separates the first cell reference and the second cell reference. The first cell reference indicates the top-left cell in the specified cell range, while the second cell reference denotes the bottom-right cell in that same range. These two cell references determines the height in rows and width in columns, of the cell range. Cell range references are used in functions that perform calculations or operations on a group of cells, rather than just a single cell.
Both single cell and multi-cell references can also include sheet names for referencing cells in other worksheets. For example, Sheet!A1 or Sheet2!B2:B10. Note that Excel requires an exclamation mark between the sheet name and the cell reference. You can find the Sheet names your workbook contains, at the very bottom to the left. Single quotation marks are used if the worksheet name contains a space character, example: 'Budget 2027'!B3
What are the different cell reference types?
- Relative: The cell reference changes when the cell is copied or moved. For example: A1
- Absolute: The cell reference is fixed and doesn't change when copied. The dollar signs lets you specify which part of the cell reference you want to be abolute. For example: $A$1
- Mixed: One part fixed, one part relative. $A1 or A$1
When are cell references used?
In formulas to perform calculations using values from other cells. For data validation, conditional formatting, and other Excel features. To link data between different sheets or workbooks.
What is a 3d reference?
In Excel, 3D references refer to the ability to reference cells or ranges across multiple worksheets within the same workbook. This can be useful when you need to perform calculations or operations that involve data from different sheets. Most Excel functions do not readily accept 3D references, which are references that point to the same cell or range across multiple sheets. The SUM, AVERAGE, COUNT, and FREQUENCY functions allow 3d references as arguments.
How to create a 3d-reference? To create a 3D reference, you use the following syntax: =SUM(Sheet1:Sheet3!A1:A10)
This formula will sum the values in the range A1 to A10 across the worksheets Sheet1, worksheets in between, and Sheet3. 3D references can use both relative and absolute references. For example:
- Relative reference: =SUM(Sheet1:Sheet3!A1:A10)
- Absolute reference: =SUM(Sheet1:Sheet3!$A$1:$A$10)
3D references are limited to the current workbook. You cannot create 3D references that span multiple workbooks. Using 3D references can be particularly useful when you have a large dataset spread across multiple worksheets and need to perform calculations or analyses that involve data from different sheets. This can help streamline your workflow and make your spreadsheets more efficient and organized.
Can the AREAS function work with 3d-ranges?
No, the AREAS function can not work with 3d-ranges. It returns a #VALUE! error.
What is a named range?
A named range in Excel is a way to assign a descriptive name to a cell or a range of cells. This can be very useful for making your spreadsheets more organized and easier to understand. Using named ranges can be a powerful tool for organizing and managing your Excel data, especially in large or complex workbooks. They can help you write more readable and maintainable formulas, and make it easier to work with your data.
You can define a named range by selecting the cells you want to name, then going to the Formulas tab and press with left mouse button oning on "Define Name". You can then enter a descriptive name for the range, such as "TaxCode" or "InventoryQuantity".
Once you have defined a named range, you can use it in formulas and functions just like you would use a cell reference. For example, you can use the named range in a formula like this: =SUM(InventoryQuantity). Named ranges can also be used in functions, such as VLOOKUP(lookup_value, SalesData, column_index, [range_lookup]).
Named ranges make your formulas and functions more self-explanatory and easier to understand. If the location of the data changes, you only need to update the named range definition rather than having to update all the formulas that reference the data. Named ranges can be used in a variety of contexts, such as in data validation rules, conditional formatting, and data connections.
Named ranges can be defined at the workbook level, which means they are available across all worksheets in the workbook. You can also define named ranges at the worksheet level, which means they are only available on the specific worksheet where they are defined.
Can the AREAS function work with named ranges?
Yes, the AREA function can work with named ranges. See an example in section 3 below.
How does a cell reference to a cell range look like?
A colon separates the start reference and the end reference. The start reference must be the top left cell in the cell range and subsequently the end reference must be the bottom right cell in the cell range. B3:G7 is an example of a cell reference to a cell range.
What does a cell reference to a single cell look like?
For example, B3 is a cell reference to a single cell.
2. Syntax
AREAS(reference)
reference | Required. A reference to a cell(s) or a cell range(s). |
Use parentheses to include multiple arguments as a single argument, see the example below.
3. Example 1
The image above shows the AREAS function in cell range B3:B6 and the formula text in cells C3:C6.
Formula in cell B3:
The formula in cell B3 returns 1 which represents the count of cell references in the argument E3:E4. This cell reference points to a cell range containing two cells.
The AREAS function is one of a few functions that allow the union operator comma , and a beginning and ending parentheses. The following formula demonstrates the use of a set of parentheses to include multiple cell references. Other functions that allow union operators are LARGE, COUNT, COUNTA, SMALL, LARGE, MIN, MAX, and AVERAGE functions.
The formula above is in cell B4 and it returns 3 which represents three cell references in (E4:E5, G3, E7:G9). The formula in cell B5 is much like the formula in cell B4 but it returns two instead of three. The argument is (E5:E6, E2:G6) which contains two cell references.
Formula in cell B6:
This formula contains a named range that contains (N16:N17,P15,N19:P21,L20:J22). The formula returns 4 which represents the number of cell references in (N16:N17,P15,N19:P21,L20:J22).
4. AREAS Function not working
Make sure to add extra parentheses if you use more than one cell reference. If you forget the parentheses Excel shows a dialog box containing the message "You have entered too many arguments for this function."
5. How to count cells in a cell reference
The formula below returns the total number of cells in the specified range.
Formula in cell B3:
This formula calculates the total number of cells in the range B3:V16 by multiplying the number of rows (14) by the number of columns (21), resulting in a total of 294 cells. This type of formula can be useful when you need to quickly determine the size or dimensions of a range of cells in an Excel spreadsheet.
Explaining formula
Step 1 - Count rows in cell range
The ROWS function calculate the number of rows in a cell range.
Function syntax: ROWS(array)
ROWS(B3:V16) returns 14.
Step 2 - Count columns in cell range
The COLUMNS function calculates the number of columns in a cell range.
Function syntax: COLUMNS(array)
COLUMNS(B3:V16) returns 21.
Step 3 - Count columns in cell range
The asterisk lets you multiply numbers in an Excel formula.
ROWS(B3:V16)*COLUMNS(B3:V16)
becomes
14*21 equals 294 cells in cell range B3:V16.
6. How to count cells in multiple cell references
Cells B3 to B5 contain different cell references with variable sizes. The Excel 365 formula in cell B8 counts the cells for each cell reference and returns a total.
Formula in cell B8:
This formula does the following:
For each row in the range B3:B5, it calculates the number of cells in that row by multiplying the number of columns by the number of rows. It then sums up all these cell counts to get the total number of cells in the range B3:B5.
Explaining formula
Step 1 - Convert text string to ref
The INDIRECT function returns the cell reference based on a text string and shows the content of that cell reference.
Function syntax: INDIRECT(ref_text, [a1])
INDIRECT(a)
Step 2 - Count columns in ref
The COLUMNS function calculates the number of columns in a cell range.
Function syntax: COLUMNS(array)
COLUMNS(INDIRECT(a))
Step 3 - Count rows in ref
The ROWS function calculate the number of rows in a cell range.
Function syntax: ROWS(array)
ROWS(INDIRECT(a))
Step 4 - Multiply rows and columns
The asterisk lets you multiply numbers in an Excel formula.
COLUMNS(INDIRECT(a))*ROWS(INDIRECT(a))
Step 5 - Construct LAMBDA function
The BYROW function requires a LAMBDA function to work properly.
The LAMBDA function build custom functions without VBA, macros or javascript.
Function syntax: LAMBDA([parameter1, parameter2, …,] calculation)
LAMBDA(a,COLUMNS(INDIRECT(a))*ROWS(INDIRECT(a)))
Step 6 - Iterate refs row by row
The BYROW function puts values from an array into a LAMBDA function row-wise.
Function syntax: BYROW(array, lambda(array, calculation))
BYROW(B3:B5,LAMBDA(a,COLUMNS(INDIRECT(a))*ROWS(INDIRECT(a))))
Step 7 - Calculate a total
The SUM function allows you to add numerical values, the function returns the sum in the cell it is entered in. The SUM function is cleverly designed to ignore text and boolean values, adding only numbers.
Function syntax: SUM(number1, [number2], ...)
SUM(BYROW(B3:B5,LAMBDA(a,COLUMNS(INDIRECT(a))*ROWS(INDIRECT(a)))))
becomes
SUM({23; 45; 200})
and returns 268
Useful resources
AREAS function - Microsoft
AREAS function
Functions in 'Lookup and reference' category
The AREAS function function is one of 25 functions in the 'Lookup and reference' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form