The post Averageif and Averageifs In Depth appeared first on Concensure Spreadsheet Templates.

]]>The functions are available in MS Excel 2007 onward, and Mac Excel 2011 onward.

=AVERAGEIF (range, criteria, [average_range])

**Range**Required. These are the ranges that contain the criteria, or if average_range argument is omitted, the actual range that contains the numbers to average.**Criteria**Required. The criteria that dictates what cells to average. It can use a logical expression such as “>5”, “<=0”, or plain expressions such as “10”, “Product”, or expressions containing wildcard characters such as “???” or “*product”. The criteria can refer to a range that contains the expression.**Average_range**Optional. Cells to apply average on. The first range argument is used if this is omitted.

AVERAGEIF() ignores text values. If you need to evaluate text values as 0 in calculation, use AVERAGEA() function with IF() function instead.

=AVERAGEIFS(average_range, criteria_range1, criteria1, [criteria_range2, criteria2], …)

The AVERAGEIFS function syntax has the following arguments:

**Average_range**Required. Cells to apply average on.**Criteria_range1, criteria_range2, …**Only criteria_range1 is required. Maximum of 127 criteria ranges allowed. t can use a logical expression such as “>5”, “<=0”, or plain expressions such as “10”, “Product”, or expressions containing wildcard characters such as “???” or “*product”. The criteria can refer to a range that contains the expression.

Notice that unlike AVERAGEIF() function, average_range is the first argument here.

Also, all the specified criteria must be true for it to not show #DIV/0! error. That is, you are effectively specifiying an “AND” condition where criteria1, criteria2 etc must all be true for their respective ranges.

The formula to average all the non-zero cells in this example is

=AVERAGEIF($A$1:$A$9, “<>0”)

You can choose not to use dollar signs ($) to fix the cell reference if the formula is not to be applied elsewhere.

If you want to only average those cells where criteria is where cells are not equal to certain text, then an example formula is

=AVERAGEIF($A$2:$A$17, “<>Central”, $D$2:$D$17)

This will average those regions that are not Central.

When you use logical operators (<, >, <>, =, <= etc) together with a cell that contains the value to compare against, you need to enclose the logical operators separately, then use ampersand (&) symbol to connect the cell reference.

For example, to average a range A2:A8 if they are less than a value in cell B2, you would write

=Averageif(A2:A8, “<” & B2)

Averageif function only allows one criteria. If you need to apply several criteria, you can use AVERAGEIFS() function.

Specifically, if you need to specify multiple OR conditions, you may use wildcards to do so. (A word of caution, you need to be very familiar with your dataset so that you do not accidentally include items you are not after). The screenshot contains the data for the example below.

An example involving wildcards:

Suppose you want the Average Floor Area (m2) for East and West Region.

An alternative solution is provided in Averageif Two Criteria In Same Column section.

The formula is:

=AVERAGEIF(A2:A26, “*st”, B2:B26)

where the star sign (*) represents one or more unknown characters.

This asks the spreadsheet program to do average on column B if column A contains words that end in “st”.

Another example, suppose you want the Average Floor Area (m2) for North Region.

The formula could be:

=AVERAGEIF(A2:A26, “N??th”, B2:B26)

Here, each question mark symbol (?) denotes one unknown character.

Essentially this criteria looks for any word beginning with N followed by any two characters then end in “th”. The first “N” precludes “South”, while the rest of the string also specifies the length of the word.

The methods explained in this post applies to both Excel and Google Sheets.

This is true also for AVERAGEIFS, SUMIF, SUMIFS, COUNTIF and COUNTIFS.

If you have multiple ranges to take into account, the best method is to use AVERAGEIFS() function instead.

Suppose you want to find properties in Central where floor area is between 30 and 50 sqm inclusive.

The formula would be

=AVERAGEIFS(B2:B17,A2:A17, “Central”, B2:B17, “>=30”, B2:B17, “<=50”)

This requires Excel or Google Sheets to find rows in Region column that meets region criteria, **AND** where floor area column is between a desired interval.

You can combine VLOOKUP() function with AVERAGEIF() to determine what category the averaged amount falls into.

For example, suppose we put a description label for different floor areas:

Floor Area (m2) | Label |
---|---|

0 | Lacking |

40 | Small |

50 | Average |

60 | Good |

70 | Comfortable |

Then the formula for the description applicable to an average dwelling in Central region would be

=VLOOKUP( AVERAGEIF(A2:A17, “Central”, B2:B17), D3:E7, 2,1 )

You can also put the word “Central” in another cell, say D9, and rewrite the formula as:

=VLOOKUP( AVERAGEIF(A2:A17, D9,B2:B17), D3:E7,2,1 )

This is effectively asking for an OR condition where as long as one of criteria1, criteria 2…is true, do the average.

Suppose the aim is to find the “Average Price / m^2 for East and West Region”

It is easy to make the mistake of writing a formula as such:

=AVERAGEIFS(D2:D17, A2:A17, “East”, A2:A17, “West”)

which gives #DIV/0! error. The reason being that you cannot ask a range to be both “East” and “West” at the same time.

What you are after is those regions that are either “East” or “West”.

The other formula below is also wrong:

=AVERAGEIFS(D2:D17, A2:A17, “East”)+AVERAGEIFS(D2:D17, A2:A17, “West”)

This is because the sum of averages is not the same as the average of total.

In this case you can either use “not equal to Central”, such as

=AVERAGEIF(A$2:A$17, “<>Central”, D2:D17)

or the following formula:

=( SUMIFS(D2:D17,A2:A17, “East”)+SUMIFS(D2:D17, A2:A17, “West”) ) / (COUNTIF(A2:A17, “East”)+COUNTIF(A2:A17, “West”))

This sums up all the values if they meet the criteria, then do an average by dividing a count of items that meet those criteria.

If you get DIV/0 error, check if any of the following is the case:

- The specified range does not contain your criteria
- There are no numbers in the average_range
- What looks like numbers in the average_range are formatted as text that cannot be converted to numbers

**Related Posts**

The post Averageif and Averageifs In Depth appeared first on Concensure Spreadsheet Templates.

]]>The post Excel LEN Function appeared first on Concensure Spreadsheet Templates.

]]>Excel LEN() function returns the length of a text string. It is often used with LEFT(), RIGHT() and MID() function to perform text manipulation. Together, these functions allow one to find a substring that is to the left or right of a certain character and so on.

LEN() function has the below syntax

=LEN(text)

where string can be a text string or be replaced with a cell address.

Note that a blank space is counted as one character, so is a tab character or a copyright symbol.

IF() and LEN() together can be used to test if a cell contains an empty string. This is different from ISBLANK() function. For example, suppose you have a formula that would return a blank string in cell A1, the formula

=IF(LEN(A1)=0, TRUE, FALSE)

will return TRUE, whereas

=ISBLANK(A1)

will return FALSE.

Another use of the combo is to tell between standard numbers and international numbers using character length.

**Related Post**

The post Excel LEN Function appeared first on Concensure Spreadsheet Templates.

]]>The post Absolute and Mixed Reference in Excel appeared first on Concensure Spreadsheet Templates.

]]>By default, when you enter an address in Excel, it is using relative reference.

As shown in the screenshot, when you drag the formula in cell E3 to cell E5, Excel automatically changes row number so that formulas are calculating correct rows.

Most of the time that could be a good thing.

However, suppose you need all formulas to refer to a fixed cell address, then after you drag the formula across multiple cells, you may need to go back to each formula to change the automatically altered address.

If you are able to fix the address, you can easily drag the formula across other cells the same way. This is where absolute reference comes in.

You may need to refer back to I4 in many cell formulas. In that case, instead of putting cell reference say I4 in a formula, you can put $I$4. This means when you apply the same formula to other cells, I4 will be a fixed or absolute reference.

This example uses a count formula to get an accumulated count of numbers in another column.

The formula in cell B2 is

=COUNT(A$2:A2)

This tells Excel to count all the cells from A2 to A2 (one cell in total).

When this formula is dragged down to cell B6, it becomes

=COUNT(A$2:A6)

which tells Excel to count all the cells from A2 to A6 if it contains a number.

As seen in the screenshot below, text or blank cells are not counted.

When the cursor is in or next to a cell reference, you can press **F4** multiple times to cycle between relative reference, absolute reference, fixed row or fixed column reference.

Make sure that your laptop registers F4 as is, or you might need to use Fn + F4 combinations depending on your keyboard setup.

If you are using Mac Excel 2011, you can use ⌘+ t to cycle between absolute, relative and mixed reference.

Mixed references are where either column or row position is fixed with a dollar symbol ($) but not both.

In the example above, cells D5, E5 and F5 are multiples of the cells to the left. The multiplication factor lies in cell I5, while the formula is across columns, so we fix the column but not the row. That is, use $I5 instead of I5. When the formulas are reused in the cells below, they will refer to the correct cell which is I6.

In general, if the reference cells are across columns, then you would fix the row but not the column. If the reference cells are across rows, then you would fix the column with a dollar sign, but not the row position.

Below is another example of where the reference cells are across columns.

To remove an absolute reference in Excel, simply remove the dollar signs by pressing F4 multiple times until both dollar signs are removed.

Once you master the use of mixed references, you will be on your way to mastering Excel.

The post Absolute and Mixed Reference in Excel appeared first on Concensure Spreadsheet Templates.

]]>The post Excel Multiply Formula appeared first on Concensure Spreadsheet Templates.

]]>An alternative is to use the PRODUCT() function. An example is

=PRODUCT(A1:A4)

This will multiply all the numbers in cells A1, A2, A3 and A4.

Below we will focus on using the asterisk symbol (*). Just keep in mind that you can replace any examples below with the PRODUCT() function.

Suppose you want to get the product of cell A1 and cell B1, you can select a blank cell, and type an equal sign to ask Excel to evaluate what follows. As such:

= A1 * B1

It is a good idea to leave a blank space before and after the multiplication symbol. This makes the formula easier to read.

To multiply two numbers, say 2 and 4, do as follows:

= 2 * 4

You can multiply numbers, numbers stored as text, decimals and dates.

To multiply a value and a cell, say 2 and cell A1, do as follows:

= 2 * A1

The order of multiplication does not matter.

To multiply two formulas, it is a good practice to put each formula in round brackets.

For example:

Formula 1: B2 + C2

Formula 2: 4 – 2

Multiply Two Formulas:

= (B2 + C2) * (4 -2)

You can add a column with formulas prewritten that will multiply the cells with a fixed number.

For example, in column A you have the numbers 1, 2 and 3.

You want to multiply each number by say, 5, as you type the numbers in column A

One way is to write the formula

=A2*5

in cell B2. Select the cell, then drag the dark cross handle down to more cells. This will fill the relevant formula in those cells. As shown:

An alternative way is to convert the data range to a table.

Select the data, press Ctrl + L or Ctrl + T to make it a table.

In a new column, type the equal sign (=), then select the cells and use the multiplication sign. Excel will put what is called a “structured formula” in the new column.

The formula may look alien at first, but you have done it using cell selection, so do not worry too much if some symbol, such as (@), does not make sense.

When you then enter a new value in the next row, Excel will fill out the new formula automatically.

The third way multiplies all numbers by the same multiple in one go.

Suppose you want to multiply all numbers by 5. Put 5 in one of the blank cells, and press Ctrl+C to copy.

Select the data, press Alt+E+S+M to do paste special.

In the dialogue that shows up, select Multiply, click OK.

To multiply two columns and them sum in Excel in one cell, you can use the SUMPRODUCT() function.

The function has the syntax

=SUMPRODUCT(array1, array2, array3…)

where array 2 and further arrays are optional and can represent cell address.

For example, suppose you have two columns as shown below.

If you multiply the two columns, you should get 32 as the answer.

Similarly, when you type the formula

=SUMPRODUCT(A2:A4,B2:B4)

This will give you the same result.

You can convert numbers stored as text to numbers by multiplying the number by 1. This is quite useful in a formula when you are not sure if the cell values are properly formatted. This will return the same number as actual numbers that you can do calculations on.

To multiply the same number multiple times, it is better to use an exponential function.

Suppose you want to multiply the number 2, 5 times.

You can use the formula:

=2^5

where the caret symbol (^), also called circumflex, allows you to do the equivalent of

= 2 *2 *2 *2 *2

The caret symbol can be found on top of the number 6 on the keyboard.

The multiplication symbol (*) allows you to get the product of numbers in succession.

Plenty of examples involving the use of numbers, cell address and formulas are given above.

The post also discussed several ways to automatically multiply cell entries by a number.

Just remember that if you are going to apply a multiplication formula that has cell addresses to other ranges, the result may not be what you expect. This is because Excel moves the cell reference in the formula according to where the new position is.

To address the issue, you can either enter each formula manually, or learn about absolute reference in formulas. Basically, the use of dollar sign ($) to fix either row or column position in cell reference.

**Related Post**

The post Excel Multiply Formula appeared first on Concensure Spreadsheet Templates.

]]>The post ROUNDUP Function appeared first on Concensure Spreadsheet Templates.

]]>ROUNDUP (number, num_digits)

**number**: the number to round up

**num_digits**: specified digit to round up to. 0 rounds up to the nearest integer. -1 will round up to the nearest 10, -2 to nearest 100 etc. 1 will round up to the nearest one decimal, 2 to the nearest two decimals etc

ROUNDUP () function rounds a number to a specified number of digits.

Formula | Result |
---|---|

=ROUNDUP(-3.22, 0) | -4 |

=ROUNDUP(2.45, 1) | 2.5 |

=ROUNDUP(2.45, -1) | 10 |

To round to nearest multiple, say 5, use MROUND() function.

=MROUND($A15, 5)

Change the second argument to -5 if the first argument is a negative number.

To round to nearest multiple, say 5, use MROUND() function.

=MROUND($A15, 10)

Change the second argument to -10 if the first argument is a negative number.

To round to nearest multiple, say 5, use MROUND() function.

=MROUND($A15, 100)

Change the second argument to -100 if the first argument is a negative number.

To round a formula result in Excel, refer to the cell address of the result in the first argument of Roundup() function.

For example, if you have in cell A1 the result 125.71 from a formula, you can round up the result in cell B1 to the nearest integer with this formula:

=ROUNDUP(A1, 0)

Alternatively, you can also put the formula in the first argument in lieu of A1 in this example.

If ROUNDUP() function is not working as expected, check that the cells are treated as numbers by Excel.

Note that text is default to align left. If the numbers are aligning to the left with a green triangle, select those cells. You will then see a small asterisk warning. Click on the warning, it should say “Number stored as text”.

Select the “Convert to number” option to convert them all to numbers.

**Related Post**

The post ROUNDUP Function appeared first on Concensure Spreadsheet Templates.

]]>The post Sorting in Google Sheets appeared first on Concensure Spreadsheet Templates.

]]>Google Sheets provides Sort function in menu, Filter view that allows you to access sort functionalities and Sort() function for automatic arrangement of data.

You can make a copy of the Google Sheets here

There is no sort button in Google Sheets. You have to access sorting function through the menu.

To sort data, select the data, then go to **Data** menu, select “**Sort Sheet by…A -> Z**” to sort in alphabetical order.

To access sort functionality for each column, go to **Data** menu, , select “**Create a filter**“. The filter in each column then allows you to do sorting from A to Z, Z to A, or by colour.

To sort a range by colour, select the data, then go to **Data** menu, select “**Create a filter**“.

You can then sort either by a cell’s fill colour or by its font colour.

To sort the whole sheet,

- Click on
**View**->**Freeze**-> 1**row**from the menu. This prevents the top row from being sorted. - Click
**Data**->**Sort Sheet**by**column**,**A-Z**(ascending) or**Sort Sheet**by**column**, Z-A (descending)

Select the data range, click **Data** -> **Sort** **range**.

If your data has a title row, check “**Data has header row**” checkbox.

For each columns that you want to sort, select the column then choose either A to Z or Z to A.

Click “**Add another sort column**” button to add additional columns in the sort hierarchy.

Google Sheets will do sorts in the order you specified from top to bottom.

To do custom sort, put the sort order list in a range for easier manipulation. In this case, cells F1 to F3 contains the desired sort order.

Sort() function has the syntax:

SORT(range, sort_column, is_ascending, [sort_column2, is_ascending2, ...])

You can add more Match() and TRUE argument pairs to do multiple column sort in custom sort order.

The Match() function will return a number based on the custom sort order specified in column F.

If the data is not sorted correctly, check that what appears to be numbers or dates are not treated by Google Sheets as text.

**Related Post**

The post Sorting in Google Sheets appeared first on Concensure Spreadsheet Templates.

]]>The post CountIf Excel appeared first on Concensure Spreadsheet Templates.

]]>COUNTIF() function has the following syntax:

=COUNTIF(range, criteria)

**range** – the range of cells where criteria should be applied

**criteria** – an expression that specifies the logic to apply

Below are some examples of COUNTIF() function that include an example where criteria is in a separate cell.

This one counts the number of “No”s in Discount column.

In cell H5, the formula is

=COUNTIF(tblStock[Discount], “No”)

You can change tblStock[Discount] table reference to

=COUNTIF($B2:$B8, “No”)

To count the number of vegetables where Quantity in Stock is less than 10

=COUNTIF(tblStock[Quantity in Stock], “<10”)

To count the number of Vegetables where Quantity in Stock is greater than 12

=COUNTIF(tblStock[Quantity in Stock], “>12”)

To count the number of Vegetables imported on or before Jan 3rd 2020

=COUNTIF(tblStock[Import Date], “<=3/1/2020”)

Suppose the date is in a separate cell AJ6, you need to separate the logical operators “<“, “>”, “=” from the cell address.

=COUNTIF(tblStock[Import Date], “<=”&AJ6)

The formula in cell I3 is

=COUNTIF(E2:E13, “?*”)

Are you seeing an unexpected result when you use COUNTA() to count cells with text?

COUNTA() will not work the way you want if the cells contain formulas.

In this case, you need to use COUNTIF(range, “?*”), where “?*” asks Excel to return only those cells with at least one character.

**RELATED Post**

The post CountIf Excel appeared first on Concensure Spreadsheet Templates.

]]>The post Project Collaboration with Gantt Chart Google Sheets appeared first on Concensure Spreadsheet Templates.

]]>Below is a simple **action plan**:

Create a Timeline Template or Gantt Chart in Google Sheets. You can change the dates so that they do not overlap and are more of a Gantt Chart than a project timeline template.

Assign task owners

Share the template with all task owners as Viewers or Editors

- File menu > Share
- In the window that appears, you can set whether “Viewers and commenters can see the option to download, print, and copy” from the top right’s gear icon.
- Add people and groups. You can assign them as Editor, Viewer or Commenter. Check to notify people. Enter a brief message. Click Send.
- In “Get link” section, you can also share document link and grant restricted permission. That is, only people added can open the link. This is another way to share the document.

Ask everyone to set notification settings to receive updates to project timeline.

- Tools menu > Notification rules.
- Select “Notify you when: Any changes are made” in most cases
- Subsequently, select either Email – daily digest or Email – right away to send an email for every change.

As soon as someone shoots you an email on changes in project delivery date, work it out on the template.

In Google Groups click on Create Group. Set the group name, group email address, language preference etc.

Send invite to project team to join the group. People in the same group have the same document access. Once they leave the group, they lose that access right.

Open Project Timeline Template or Gantt Chart Google Sheets.

You can dictate who has the authority to edit certain ranges.

Go to Data > Protected sheets and ranges

Click “Set permission”.

You then have the option to “Restrict who can edit this range” and “Show a warning when editing this range”.

In Google Sheets, you can click insert comments in cells (Insert > Comment). You then put a plus sign (+) followed by a person’s email address. By checking the “Assign to …” checkbox, this will assign the task to that person. The person will get a link to the file and an email notification. You can even add multiple people.

For remote teams, use Google Meet to host online meetings. You can access Google Meet directly from Gmail or Google Calendar interface.

Google Meet allows you to share your screen so that you can resent your project plan remotely.

In Google Play store or App Store, find and install Google Sheets app.

This will allow you to view and edit Google Sheets on the go.

You can download a free Timeline Template Google Docs where dates will naturally expand as you put in start and end dates.

Alternatively, you can buy an improved version built on top of that, which will allow you to:

- Set Task Mode as either Done, Cancelled, In Progress or Not Started
- See task owners by picture
- Easily insert comments on tasks. Select the task, go to Insert menu > Comment (shortcut Ctrl+Alt+M)
- Edit Duration to control task end date
- Calendar dates in row 6 expand and shrink according to Start and End date

and more features to come.

Once you purchase the product, you will enjoy lifetime access to the document and all the upgrades that come with it.

This Gantt Chart Template Google Sheets product is free for the moment as more features are being added. Not for long though.

If you want a link to the product, put in comment below on what you would like to change on the product to make it fit your purpose. I will send you a link to copy the sheet in 48 hours.

Note that the system will check the validity of the email and so will take longer to jump to next page.

As shown, GSuite offers many features that will satisfy the regulation of access rights, sharing of contents, assignment of tasks and so on.

While it is certainly in no way as powerful as Microsoft Project, it could be a no brainer for teams already on GSuite for Business for a simple team project.

The post Project Collaboration with Gantt Chart Google Sheets appeared first on Concensure Spreadsheet Templates.

]]>The post SUMIF Function appeared first on Concensure Spreadsheet Templates.

]]>The criteria can test whether the range equals to a certain text string, greater or smaller than a number, between certain dates etc. You can also use wildcards for fuzzy match.

SUMIF() is one of the most used functions in Excel and definitely worth mastering if you are learning Excel. Its cousin, SUMIFS(), allows more complicated criteria.

Whether you are doing SUMIF() function on Excel or Google Sheets, the formulas are the same.

=SUMIF(range, criteria, [sum_range])

**range **– Required. This is the range where criteria shall be applied.

**criteria **– Required. This tells the program which cells in sum_range should be added

**sum_range **– Optional. This is the range to sum.

We will go through SUMIF() usage in more details below using examples.

This is the simplest case where criteria is a value in a cell.

Suppose we want to know the total quantity in stock for vegetables where there is a discount.

The formula in cell H5 is

=SUMIF(tblStock[Discount],$H$4,tblStock[Quantity in Stock])

where H4 contains the word “Yes”

If you do not intend to drag the formula to other cells, then you do not need dollar signs ($) in front of the address range.

You can check in criteria argument whether the range argument contains certain text.

You then enclose the text in double quotes.

Again, we are after the quantity in stock for vegetables where there is a discount.

In cell G9, the formula is

=SUMIF(tblStock[Discount],”Yes”,tblStock[Quantity in Stock])

SUMIF() formula supports wildcard symbols for near match search.

“?” stands for one character, and “*” for multiple characters.

Suppose we want to sum Quantity in Stock for all Vegetables where Vegetable name starts with “P”

In cell G13, the formula is

=SUMIF(tblStock[Vegetables],”P*”,tblStock[Quantity in Stock])

If you want where Vegetable names contain the character “al”, you would change criteria argument to “*al *”

The best way to sum between two values is to use SUMIFS() function instead.

SUMIFS function has the syntax:

=SUMIFS(sum_range, criteria_range, criteria_1, criteria_range, criteria_2…)

Notice that in SUMIFS(), sum_range is the first argument, not the last.

Criteria_range and criteria arguments come in pairs. Criteria argument defines what criteria to apply to criteria_range. You can specify multiple criteria ranges.

Scenario: To sum Quantity in Stock for all Vegetables where Quantity in Stock is between 5 and 7

Cell G17’s formula is

=SUMIFS(tblStock[Quantity in Stock], tblStock[Quantity in Stock],”>=5″,tblStock[Quantity in Stock],”<=7″)

If you want to sum a numerical column based on date ranges in other columns, you can either put the dates with the logical operators (<, >, =) together inside double quotation marks or use an ampersand (&) sign to connect them.

As an example, suppose you want to sum Quantity in Stock for all Vegetables where Import Date is on or after 5th Jan, and Promotion Date is before 7th Jan.

Note that in this example, the dates are from two different columns. The more common example is where the date range comes from a single column.

=SUMIFS(tblStock[Quantity in Stock], tblStock[Import Date],”>=5/1/2020″,tblStock[Promotion Date],”<7/1/2020″)

OR

=SUMIFS(tblStock[Quantity in Stock], tblStock[Import Date],”>=”&D21,tblStock[Promotion Date],”<“&E21)

where cell D21 contains the value Jan 5th 2020, and cell E21 the value Jan 7th 2020.

Check that the formula is constructed correctly and that the date column you are referring to are formatted as dates.

This post addresses most common issues you would face when using SUMIF. Plenty of examples are given along with a quick debug of using SUMIF() with date ranges.

It is worth spending time learning about SUMIFS() to work with multiple conditions.

**RELATED POSTS**

The post SUMIF Function appeared first on Concensure Spreadsheet Templates.

]]>The post Excel Filter Function Comprehensive Guide and Examples appeared first on Concensure Spreadsheet Templates.

]]>Excel Filter function is used to return multiple results matching a search criteria. It is available in Microsoft 365 current channel subscribers only. If you use Office 2019 or older versions to open a workbook built with FILTER() or other dynamic array formulas, it will not work.

=FILTER(array, include [if_empty])

**array** – the range to include in result

**include** – criteria. That is, what to include.

**if_empty** – what to do if FILTER returns an empty array. Normally set to double quotation marks “”. According to Microsoft, “If your dataset has the potential of returning an empty value, then use the 3rd argument (**[if_empty]**). Otherwise, a #CALC! error will result, as Excel does not currently support empty arrays.”

The examples below come from a fictional membership database of a magazine company. Some members do not provide their full names, and so you might see people on a first-name basis in Full Name column.

Let’s begin Excel FILTER() function guide with a simple example, then we will move towards more complex cases and debugging.

In the example below, the user put in a name in cell H2, to populate fields below the range G4:J4. Since there are two names matching the input, two fields are returned.

If you simply want to return Email column without the names, you can change the array reference in first argument to $E$1:$E$63 instead. Same goes for if you want to return phone and email, then you use $D$1:$E$63 as array argument.

The thing to take note of is that you cannot ask FILTER() function to return columns that are not next to each other. Also, you cannot rearrange the column order. We will see how to do these further down the post.

Excel FILTER() function does not allow wildcards, “?” or “*” symbols.

To find near matches, you can use ISNUMBER(SEARCH(find_text, within_text)) in Include argument instead. In which case, you do not need to include wildcard characters.

If you need to match cases, replace SEARCH() function with FIND() function.

In the screenshot, you can see four coloured cells that should be the right matches.

The formula in cell F5 is

=FILTER($A$2:$D$24,ISNUMBER(SEARCH($G$2,$B$2:$B$24)),””)

If you have criteria that applies to multiple columns, you can extend the principles described below to build your formula.

If you only want to return records where two or more criteria need to be true at the same time, you are applying AND logic.

To do this, enclose each criteria in a round bracket, and multiply them using asterisk (*) symbol.

In the example, we are looking for where Full Name is GARCIA and Subscription Date is in the year 2021.

The formula in cell G14 is

=FILTER($B$2:$E$63,($B$2:$B$63=$H$10)*(YEAR($A$2:$A$63)=2021),””)

Here we are using Year() function on the range in column A to return year from dates.

If you want to return records that match any one of the specified criteria, you are applying OR logic in Excel FILTER() function.

To do this, enclose each criteria in a round bracket, and add them up using plus(*) symbol.

Supposed we want to search records where Full Name can be either MARTIN or GARCIA.

The formula in cell G22 is

=FILTER($B$2:$E$63,($B$2:$B$63=$H$18)+($B$2:$B$63=$H$19),””)

Note that the use of dollar ($) sign is not necessary since you do not need to drag the formula across a range. It is however, a good habit to stick to.

It is recommend that data be converted to a table (Ctrl+T keyboard shortcut). The advantages being

- You do not have to update the range in formula
- Easier to select the range since you do not need to know position of the last row (This only applies if you are not selecting the whole column in the first place)
- Ranges in formula are referred to by their column names, giving them meaning.

In the downloadable workbook, range addresses in Data worksheet are replaced by their table counterparts. This is done easily by replacing the range, then use the mouse to select table columns.

An example with single criteria in cell G5 is

=FILTER(tblData[[Full Name]:[Email]],tblData[Full Name]=$H$2)

where

tblData[[Full Name]:[Email]] specifies the columns to return, namely Full Name column to Email column inclusive.

This trick is from Leila Gharani. You can find the Youtube link here.

In the downloadable Excel Filter Function workbook, you can find it in “Incongruous Column” worksheet

Essentially you apply another FILTER() to your original FILTER() function to take out columns you do not want to be included. This is done by array constants that signal to Excel what to include. Any value greater than 0 means to include, 0 means to exclude.

The formula in cell F5 is

=FILTER(FILTER($B$2:$D$24,$C$2:$C$24=$G$2,””),{1,0,1},””)

Here, array range is between columns B and D. However, since we tell Excel to ignore the middle column (column C), it will only return columns B and D.

You can include as many columns as you like in array range, but then you will need to also expand the number of constants between the curly brackets. So say you referenced five columns, and you want to show the first, second and last only, then you should have {1,1,0,0,1} in your Include argument of that outward FILTER().

In Reverse Column worksheet, two methods are given.

The first one is easiest to get, although it involves dragging the formula across. The example given returns two columns. You can however, apply it to multiple columns and extract any column in any order.

Here is a formula as an example:

=INDEX(FILTER($A$2:$B$24,$B$2:$B$24=$G$2,””),,2)

This will return the second column, column B, from the filter range.

This is faster than specifying single column in array argument (first argument), and having to change range reference when formula is applied to other columns.

The second method uses the classic IF({1,0}) array trick to return two incongruous ranges.

For example, the formula in cell F12 is

=FILTER(IF({1,0},$B$2:$B$24,$A$2:$A$24),$B$2:$B$24=$G$2,””)

This swaps the position of columns A and B in the result returned.

If your FILTER() function is returning #CALC error, it could be that you included cell ranges in Include argument that do not return the same data type as you expected. For example, you may have included header cell in a column of dates.

Alternatively, if you don’t specify the third argument, if_empty, and FILTER() returns an empty array, it will give #CALC error.

If you have error values in ranges referred to in the second argument, it can result in #N/A or #Value error.

Also, if the dimension of your Include array is not the same size as one of your data array columns in the first argument, it will return #Value! error.

In most use case, FILTER() function returns an array that cover multiple rows, with a width equal to what you specified in the first argument as the column range.

If there are cells with values located in the path of the array range, then instead of overwriting those cells, Excel will tell you that something is in the way. Clear up these cells first.

Excel filter function is not available in Excel 2016 and previous versions. So do not be surprised if you think that the filter function is missing from Excel. You can however, use free Microsoft Excel Online or Google Sheet to use and practice the function.

If you using Microsoft 365 but could not find the function, it could be that the Excel version is not from Current Channel.

FILTER() function is part of a dynamic array formula family. It spills out a range instead of a single cell. This means it can return multiple values without needing you to drag the formula. The alternative could be to use the traditional way in Excel to fill out a range with Index() formulas or the likes.

Suppose we want to list all records in Full Name, State and Phone columns for a person.

Select the data range. Go to Insert tab, click on “Pivot Table” in Tables group.

Find an appropriate worksheet location to insert the pivot table.

Drag the three fields into Rows field.

Go to Design tab, for Report Layout, pick “Show in Tabular Form”.

For Subtotals, select “Do not show subtotals”.

You can then click on the filter in Full Name field of the pivot table. Select “Label filters” > Equals, then type the name you want to filter for.

The upside of using a pivot table is that when you put in label filter, you can use wildcard for fuzzy search.

You can use the class INDEX SMALL IF array formula to return multiple results. This is perhaps the best alternative to Excel FILTER() function. You can also use it with multiple criteria.

When you use the function, apply Ctrl+Shift+Enter instead of Enter to make it an array formula. Then drag the formula to other ranges.

Suppose we want to see all records from Subscription Date and Full Name columns, where State is in “PA”.

The formula in cell F8 is

=IFERROR(INDEX($A$2:$D$24,

SMALL(IF($C$2:$C$24=$H$3,

ROW($B$2:$B$24)-MIN(ROW($B$2:$B$24))+1),

ROWS($8:8)),1),

“”)

$A$2:$D$24 is the data range

$C$2:$C$24 is State column, or where criteria is applied.

ROW($B$2:$B$24)-MIN(ROW($B$2:$B$24))+1 this returns the row position of matching records within the data range

ROWS($8:8) lets Excel return 1, 2, 3 and so on, as the formula is dragged down. Combined with SMALL() function, it asks Excel to return the Nth found result.

You will most likely need to adapt the formula to your situation.

Also note that in this example, Full Name column uses 2 as the last argument in Index() function instead of 1. It just tells Excel which column to return. You can change it using Columns() function to be more dynamic, similar to how ROWS() function is used in this case.

If you are only expecting one result based on your criteria, DGET can be an option.

The upside of DGET compared to pivot table option is that

- you can change multiple filter criteria easily and
- when data changes, you can see updated result instantly, as opposed to pressing “Refresh All” button
- you can use wildcards in DGET

The downside of DGET function is that if it finds multiple matches, it will return an error.

In the screenshot below, the attempt is to find people with the name Garcia where subscription date is after May 31st 2020. Alternatively, if a person is named Martin, and he subscribes after Jan 1st 2023, and he resides in State PA, that would be acceptable as well.

If a #NUM! error is returned, you will need to specify a stricter criteria so that it will only return one result.

**RELATED POST**S

Excel Dynamic Search using Filter Function

The post Excel Filter Function Comprehensive Guide and Examples appeared first on Concensure Spreadsheet Templates.

]]>