The post Finding the Largest Negative Number in Excel appeared first on Spreadsheet Labs.

]]>First of all, when talking about negative numbers, which number is greater and which is lesser? Is -8 greater than -3, or is it less than -3? The answer is -8 is less than -3. So when finding the largest negative number, the number closer to zero is greater than the number further from zero.

To sum it up, -3 is larger than -8. Keeping this in mind will help when trying to find the largest negative number in a list.

A question to ask is: When would you want to find the position of the largest negative number in a descending list?

Imagine that you have a starting balance that is reduced each week, and you want a formula to calculate what week the balance ends up being below zero. This would be the week that has the largest negative number. Now this can change – the starting balance could be different; the amount it is reduced each week could be different.

See the example below:

So you want to find the week number for the largest negative number. You can see in the example image that this is Week 17.

But now, how would you use a formula to find it automatically?

The formula would need to ensure that all variables of are handled. The starting balance could change; the amount the balance is reduced each week could vary; the value that you want returned is to the left of the value you are checking. So a standard VLOOKUP wouldn’t work.

How can this be handled? The formula to calculate would include four separate functions – INDEX, MATCH, LARGE, and COUNTIF. And here it is:

Now that’s a lot of functions to combine, and the formula can be complex at first glance. However, breaking it makes it simpler and easier to understand what’s happening. Lets’s start breaking down the formula.

This function counts the number of numbers in all of column B that are greater than or equal to zero. This seems counter-intuitive since we want the largest number that is less than zero. But hold on…we’ll get to that later.

Using the data above, this function returns the value of 16, since there are 16 numbers in column B that are greater than or equal to zero.

This function returns the nth largest number in column B. The nth number that the LARGE function is being told to return is the result of the above COUNT function, which in this example, is 16.

The 16th largest number in column B is 5. Still not the number we are looking for – that comes next.

This takes the number returned from the above COUNTIF function and adds one to it. Why do this?

Remember that the result of the COUNTIF function was 16, and this number was passed to the LARGE function. Without adding 1 to the 16 that is being passed to the LARGE function, the LARGE function would take the list of of descending numbers in column B and find the 16th largest number that is greater than or equal to zero.

That is not what is wanted. What is actually wanted is the first negative number (the greatest negative number).

That is why 1 is added to the 16. Since, in the list of descending numbers, there are 16 numbers greater than or equal to zero, the next largest number would be the largest negative number.

**And that is the number that we want! In this example, the 17th largest number is -28.**

Now, to get the matching week name. The example shows that the week name is in cell A18 and is Week17. Since the week name is in the column to the left of the searched value in column B, a standard VLOOKUP function won’t work. A combination of INDEX and MATCH will allow the value to the left to be returned.

Here the MATCH function takes the result of the functions above, which is -28. It then looks in column B for that number and returns its position. The match type argument is 0. This tells the function that an exact match is wanted. The -28 in column B is in position 18.

Lastly, the resulting 18 is passed to the INDEX function part of the formula.

The index function now looks in the 18th cell of column A and returns that value, which is:

**Week17**

Here you have seen how to use a formula in Excel to find the largest negative number. While this formula uses four different functions, and does seem complex, it is very flexible.

The post Finding the Largest Negative Number in Excel appeared first on Spreadsheet Labs.

]]>The post How to Backup Excel Workbooks [and Save Your Day] appeared first on Spreadsheet Labs.

]]>These are situations that has probably happened to 95% of Excel users. But, you have File History turned on, right? No? Well, at least your IT department creates nightly backups. But a lot of help that is since you just created the workbook this morning and worked on it all day, so no backup until tonight. Or, what if you are on your home computer with no IT department to manage the backing up of your system?

It’s good that Microsoft has built-in some backup functions in Excel. How do they work? Let’s see.

AutoRecover is an setting that Microsoft added to Excel. Excel’s built-in AutoRecover options can be accessed in Excel 2016 under File…Options…Save. It defaults to saving the AutoRecover information every 10 minutes, and can be changed to every 1 to 120 minutes.

As well, you have the option of saving the AutoRecover information for a workbook if you close it without saving.

In addition, the location the AutoRecover file is saved to can be changed. Also, you can turn off AutoRecover for each workbook.

The image below shows the relevant information and settings for Excel’s AutoRecover.

If AutoRecover is enabled, the timer starts as soon as Excel is opened. When the set time is reached, Excel checks all open workbooks to determine if any of them have changed. If they have changed, Excel then starts another timer to check if Excel is idle. Every time you make a change to the file, that idle timer is reset.

The idle timer is 30 seconds, but it can be changed via the registry.

There are variations to recover an AutoRecover of a workbook, depending on whether the file was never saved, or if the file was saved at least once. The processes follow below.

If you have never saved the current workbook, and close it without saving, or lose the power to your computer, it could still be possible to recover the file depending on the AutoRecover time settings. If you have the time set to the default 10 minutes and close the workbook without saving before 10 minutes (or even longer depending when Excel was last idle), nothing will be able to be recovered.

To recover the AutoRecover for a file that wasn’t ever saved, go to File…Info…Manage Workbooks…Recover Unsaved Workbooks as shown below.

If your workbook was saved at least once, and you close it without saving, the process to recover an AutoRecover file is relatively the same.

Go to File…Info…Manage Workbooks and then select the AutoRecover file want to open as shown below.

A new feature introduce in Excel 2016 and that is only available in Office 2016 with an Office 365 subscription is AutoSave. AutoSave will automatically save your Excel workbook in the background every few seconds as long as it is saved to OneDrive or SharePoint.

Your changes are saved to the cloud, and other uses of the same workbook can see your changes.

To restore a previous version, click on the file name at the top of the Excel window, and then click **See all versions**. You can then pick which version you want to restore. When you click the version you want to restore, it will open in a new window. If you click the **Restore** button, the old version window will close and the selected version will become active.

With AutoSave enabled, there is no longer an ability to **Save** or **Save As** the file. The only option is **Save a Copy**.

If you are working on a file that is not saved to OneDrive or SharePoint, AutoSave is disabled for that file. As well, if you are working on a workbook saved in the older Excel file format of .xls, AutoSave will be disabled.

The default setting for workbooks saved to OneDrive or SharePoint is to have AutoSave enabled. AutoSave can be turned off, and that setting will stay for that individual file every time you open it. Likewise, if you turn AutoSave back on, it will stay on for that file.

Even if AutoSave is turned off, AutoRecover will still work if it is enabled. Also, if AutoSave is turned on, AutoRecover is off.

AutoSave can’t be turned off as a global setting; it can only be turned off on a workbook by workbook basis.

Having an Excel backup of your workbook is necessary. AutoRecover seems like a good concept – in theory. However, since it relies on waiting for Excel to be idle for 30 once the desired backup time is reached, it could end up never saving a large amount of changes that have been made to a workbook.

As a result, a large amount of your work could be lost if you are busy entering data or formulas, and don’t leave Excel idle long enough to trigger the idle timer.

AutoSave also is a good concept. But it is limited to Excel 2016 that is subscribed to via Office 365. If you have an older version of Excel, or purchased it outright – no AutoSave feature for you.

In addition, AutoSave only works on newer versions of Excel files, and only if they are saved to OneDrive or SharePoint. This does limit those who prefer to save the files to a network location or even on a local hard drive.

There are two add-in solutions for backing up your Excel workbooks. With the Better Backup Free and Better Backup Pro Excel add-ins, you can ensure that backups of your Excel workbooks are done.

Both versions can automatically save backup copies of your active workbook, and append text and time to your backups. Click here to see a comparison of the two versions.

These add-ins aren’t limited to the number of backups made, won’t delete any backups that are created, and give you flexibility in where and when you backup your Excel workbooks. Check them out.

The post How to Backup Excel Workbooks [and Save Your Day] appeared first on Spreadsheet Labs.

]]>The post How to Use the Excel MATCH Function [In Detail] appeared first on Spreadsheet Labs.

]]>Excel’s MATCH function lets you tell it what item to look for in a range, and it then returns the position of that item in the range. Note that it returns, not the item, but the position of the item in the range. This is different from the LOOKUP functions.

Again, it’s pretty simple and basic. However, it’s a powerful function that can be combined with the INDEX function to create very advanced lookup formulas. Here’s how to use it.

Here’s the Excel MATCH function:

lookup_value = the value you want to find. It’s required.

lookup_array = the range of cells to search for the value. It’s required.

[match type] = tells the function how it matches the lookup_value in lookup_array. It’s optional. If you use it, you pass the values of either -1, 0, or 1 to the function.

match_type value | Description |
---|---|

-1 | Return the smallest value that is greater than or equal to the lookup_value. The data in lookup_array must be in ascending order. |

0 | Return the first value that is equal to the lookup_value. |

1 | Return the largest value that is less than or equal to the lookup_value. The data in lookup_array must be in descending order. |

The sample below will be used as the basis for the examples in this post. Using text for the lookup_value as well as using values for the lookup_value will be shown.

With the above example, enter the following formula:

**=MATCH(“Green”, A2:A6)**.

This will return the result of “3”.

The above formula is looking for the position of the text “Green” in the area of cells A2 to A6. Since the text “Green” is the third cell, the result of “3” is returned.

The match is not case-sensitive, and will return the position, even you enter “0” as the match type.

Also, if you use text for the lookup_value, and also use “0” for the match_type argument, wildcard characters of question mark (?) and asterisk (*) can be used as part of the lookup_value. If you actually want to search for a question mark or asterisk, you will need to type a tilde character (~) before it.

For example, using the formula:

**=MATCH(“Ye*”, A2:A6,0)**,

will return “2” because “Yellow” is in position 2 in the lookup_array range.

Changing the formula to:

**=MATCH(“Bl*”, A2:A6,0)**,

will return “4”. Note in the sample, there are two values in the lookup_array range that contain start with “Bl”. These are both “Blue” in position 4 and “Black” in position 5. Since the “0” match_type argument will return the first result that matches, it returns “4”, since “Blue” is the first match.

This may result in unintended results, so you may have to change the lookup_value criteria to be more specific, depending on your requirements.

Using the same sample data, enter the following formula:

**=MATCH(80, C2:C6)**.

This will return the result of “4”.

The above formula is looking for the position of the value “80” in the area of cells C2 to C6. Since the value of “80” is the fourth cell, the result of “4” is returned.

Now, change the above formula to this:

**=MATCH(79, C2:C6)**.

This will return the result of “3”.

The above formula is looking for the position of the value “79” in the area of cells C2 to C6. Note that there is no value of “79”.

As there is no entry for the match_type argument, the default match_type of “1” is used. The argument of “1” tells the function to find the largest value that is less than or equal to “79”. In the range above, that value of “50” is in the third cell, so the result of “3” is returned.

Now, change the formula to:

**=MATCH(79, C2:C6, 0)**.

The match_type argument of “0” tells the function to find an exact match. Since there is no exact match, the function returns the error result of “#N/A”.

How about if you enter this formula:

**=MATCH(79, C2:C6, -1)**?

The match_type argument of “-1” tells the function to find the smallest value that is greater than or equal to the lookup_value. Since the lookup_value is “79”, it would be reasonable to expect the function to return “4”, since the smallest value greater than or equal to “79” in the range specified is “80”, which is in position “4”.

However, the function will return the error result of “#N/A”.

This is because the values in the lookup_array range have to be in **descending order** if you use the match_type argument of “-1”.

Also, if you use the match_type argument of “1” to get the largest value that is less than or equal to the lookup_value, the lookup_array range values need to be sorted in **ascending order**.

On its own, there aren’t that many uses for the Excel MATCH function. One use of the function on its own is to use the function to have a formulaic way to verify that a value or text exists in a list.

However, when combined with other functions, MATCH becomes more useful. Such as, when combined with INDEX, it provides a powerful, and flexible replacement for VLOOKUP.

The post How to Use the Excel MATCH Function [In Detail] appeared first on Spreadsheet Labs.

]]>The post Using the (Simple) Excel INDEX Function appeared first on Spreadsheet Labs.

]]>For example, an index in a printed book would be a list of topics, typically in alphabetical order, and would show what page the topic would be on.

This is a fitting description for the Excel INDEX function, except that the Excel INDEX function does this in reverse. You tell the INDEX function where to look, and it returns the value in that location.

Using the example of the book from the above paragraph, you would pick a page and then list what topics are found on it.

Excel’s INDEX function lets you lookup a value based on the row and column passed to the function.

Here’s Excel’s INDEX function:

array = a range of cells or an array. It is required.

row_num = the row in the array to return a value from. This is optionally required. See the note below.

*Note: If row_num is not included, column_num must be included.*

[column_num] = the column in the array to return a value from. This is also optionally required. See the note below.

*Note: If col_num is not included, row_num must be included.*

*If you include both row_num and column_num, the INDEX function returns the value where the two arguments intersect.*- If you set row_num or column_num to zero, INDEX returns the value in the entire row or column.
- If row_num or column_num refer to a location outside of array, the #REF! error will be returned.

Using the above example, entering the formula:

**=INDEX(A2:B6, 1, 2)**

The A2:B6 tells the function to look in the range of cells from A2 to B6.

The image below highlights the area that it looks in.

The “1” passed to the function tells the function to look in row one of the range, which is equal to cells A2:B2.

The image below highlights the area that it looks in.

Next, the “2” passed to the function tells the function to look in column two of the range, which is equal to cells B2:B6.

The image below highlights the area that it looks in.

Now, if you look at where the two red rectangles intersect, you will notice that there is one cell. This is the cell that is returned by the function.

The result of this function is the value in cell B6, which is “Large”.

That’s how you use the function. Now why would you want to use it?

Now that how it works is explained, why would you want to use it?

Take a scenario where you have a list of items. You can use the INDEX function to look up a specific item in the list.

That’s about it. There’s not much more to say about this function.

But like so many of Excel’s functions, it can be combined with other functions to create powerful tools. Take, for example, combining the INDEX function with the MATCH function. These two, in combination, are an excellent replacement for the VLOOKUP function.

Excel INDEX is a pretty straightforward function that does one basic task. It looks up a value based on what row and column is passed to it and returns that value.

It’s true power lies in its ability to be combined with other functions to create very powerful Excel tools.

If you have tips or comments on how you use the INDEX function, please let me know.

The post Using the (Simple) Excel INDEX Function appeared first on Spreadsheet Labs.

]]>The post Finding the Excel Add-ins Folder Location appeared first on Spreadsheet Labs.

]]>Use the steps below to find the Excel Add-ins folder location:

1 – Click the Develop tab on the ribbon. If you don’t have the Developer tab, follow these steps to show the Developer tab.

2 – Click the Excel Add-ins button.

3 – Click the Browse button on the dialog box that opens.

4 – Here is the location of the Excel add-ins on the computer. You can now note it, or right click the address bar and copy the address for later use.

The post Finding the Excel Add-ins Folder Location appeared first on Spreadsheet Labs.

]]>The post Adding an Excel Chart Target Line [Detailed Instructions] appeared first on Spreadsheet Labs.

]]>A target line is usually a straight line on a chart that indicates the target, goal or budget. It allows a quick visual comparison to be made to see if the target is being met or exceeded.

Optionally, a target line can also be variable and not a straight line on the chart. This depends on what data you are using, and what you want to show. For example, if you have several different, separate lines, each with their own budget and actual spend, and you want to show them all together on the chart, you can show a different target for each budget line on the same chart.

Excel 2013 and Excel 2016, makes the process of adding a target line very simple and easy. Combo charts were added in those versions. Here you will see how the combo chart makes the process of adding a target line to a chart very simple.

How to show those types of charts in Excel 2016 will be shown below. Both how to build a chart with a single target line, and how to build a chart with multiple target lines will be illustrated. There will be two different methods shown to create multiple target lines.

This post is a little long with different sections, so here are links to the different sections:

Assume you have a fixed budget or target for each month of the year, and variable expenses each month. This is quite a typical scenario. So, a chart with a straight line showing the budget across the chart with columns each month showing what was actually spent is an ideal way to present the data.

Here’s the data that will be used for a straight line target chart. Notice that there are twelve months, the target is the same for those twelve months, and the actual amount changes each month.

To create a chart with a target line, you simply need to add a combo chart. Very quick and simple so far.

When you insert the combo chart, you are presented with options to decide what type of chart styles you want to combine and what values from the selected data will assigned to each chart style. This is where Excel 2016 makes it very simple.

Here’s how to do it:

Click somewhere in the data, or highlight the whole region of data.

Click insert Combo Chart under Charts

Click the Create Custom Combo Chart… option

Change the target series to a line chart, and change the Actual series to a column chart. If any of the series have Secondary Series checked off, remove the check mark. Both series need to be on the same axis, or the results for this chart will not be correct.

Sit back and enjoy your new chart!

The target now shows as a line on the chart, and the actual expenses for each month can now be easily visually compared to the target.

The previous example showed how to show a single, fixed target or budget line. This works great when looking at a single line of expenses with a fixed budget. However, what if you had a few separate lines each with their own budget or target that you wanted to compare on one chart?

Looking at the sample data shown below, you can see that there are eight different projects, each with their own budget and actual expenditures.

The process to show multiple target lines is quite similar to the process to show a single target line, as demonstrated above.

There are two different ways to show the budget or target line when showing multiple lines on a chart. You can use markers or you can use error bars. First the use of line markers will be shown and then later, error bars will be used.

Here’s how to do it:

Click somewhere in the data, or highlight the whole region of data.

Click insert Combo Chart under Charts

Click the Create Custom Combo Chart… option

Change the Budget series to a Scatter chart, and change the Actuals series to a column chart. If any of the series have Secondary Series checked off, remove the check mark. Both series need to be on the same axis, or the results for this chart will not be correct.

Sit back and enjoy your new chart!

The budgets for each project now show as dots on the chart, and the actual expenses for each project can now be easily visually compared to the budget.

The marker dots for the budget can be changed to a variety of shapes. To do that, right click one of the marker dots, and then select Format Data Point. After selecting Fill & Line, Click Marker, and then click the arrow beside Marker Options. Make sure the radio button beside Built-in is selected, and then select the type of marker you want. You can also change the size of the marker. The image below shows the available markers that you can choose from and how to select them.

Below is the same chart shown above, but with a straight line chosen as the marker, and the size of the marker increased to 14.

Depending on the data that you use for the charts or the number of different separated budget and expense combinations that you want to show, line markers may not be the best way to go. Using line markers to show the target could end up making the difference between the budget and actual amounts hard to see since the markers could end up begin very thick. This is due to increasing the size of the marker to make it as wide as or wider than the column also increases it height.

A way to adjust the budget section of the chart to be thinner is to use error bars instead of the markers. This creates a line on the chart for each budget rather than the thick markers. The line for the error bars can be changed for its color, size and much more.

Here’s the error bar method:

Use the exact same process of steps 1 through 5 as outlined above for using line markers and then continue on doing this:

Select the series for the budget line by clicking one of the markers. Make sure the whole series is selected. Click Design under Chart Tools on the ribbon. Click Add Chart Element under Chart Layouts on the ribbon. Move the selector over Error Bars. The image below shows this.

For the data and chart used in this example, both horizontal and vertical error bars were automatically added and the vertical error bars were selected. You only want horizontal error bars, so remove the vertical error bars. To do this, select the vertical error bars, then select Fill & Line and the click the radio button beside No Line. The image below illustrates this.

The line markers now need to be removed. To do this, select the marker lines. You may need to click out of the chart and then select the marker series. Once selected, change the Marker Options to None, as shown below.

Now the horizontal series of the error bars can be formatted. Select the horizontal error bar series. Change the End Style to No Cap, and change the Error Amount to Custom. Click the Specify Value box and in the pop-up form, change both Positive Error Value and Negative Error Value to .4. The changes are illustrated below.

And here is the result of all that work.

Notice, though, that there is no legend showing what represents the budget. This is because the marker was changed to None in step 8 above. A workaround is to draw a line identical to what you set for for horizontal error bar.

Here is the same chart after adding a line as a drawing and moving it onto the chart legend. If the chart is resized or moved, the drawn line for the legend will also need to be resized or moved.

The error bars can be changed in color, size, transparency and dash type. This makes them very flexible and versatile.

Budget or target lines on chart are great for visually showing the target and whether or not the target is actually be achieved. There are different ways of presenting the target on charts, and can be quite a bit of flexibility available in Excel for changing the charts to present what you want.

If you have any tips or questions, please feel free to comment below.

The post Adding an Excel Chart Target Line [Detailed Instructions] appeared first on Spreadsheet Labs.

]]>The post Live Transpose in Excel With an Array Formula appeared first on Spreadsheet Labs.

]]>This may be your desired result, but if you want the transposed copy of the data to update at the same time as the original data changes, there is a way create a transposed copy that changes along with the original data. This will create a “live” transposed copy.

The way to do this is by using an array formula. Check here if you want more information on array formulas. As a quick note, you do need to use CTRL + SHIFT + ENTER when entering an array formula for it to work.

To illustrate how a live transpose in Excel works, take a look at the sample image below. It shows the original table of data that will be the source for the live transpose copy.

Once you decide where you want the live transposed copy of the original data to be placed, you just need to highlight a range of cells that is equal to the transposed version of the original data. Note that it is the opposite size of the original data, since it is a transposed copy.

Therefore, In this example, since the original data is 14 columns wide by 9 rows high,when the data is transposed, its shape will change to be 9 columns wide by 14 columns high.

So you need to select a range that is 9 columns wide by 14 columns high.

Once you have highlighted the range where you want the live transposed copy of the data to be located, start to type the TRANSPOSE formula. You can either click in the formula bar first, or just start typing the TRANSPOSE formula. In the example here, it would be:

=TRANSPOSE(A1:N9)

And when you type CTRL + SHIFT + ENTER after typing it, it turns into this (NOTE the curly braces that were automatically added):

{=TRANSPOSE(A1:N9)}

And this is the resulting view:

Anywhere you click in the range, the formula in the formula bar does not change. It stays the same.

Now, if you change any values in the original data, the transposed version will automatically update to the new value you have entered.

Hopefully, this post has shown you how to use an array formula version of the TRANSPOSE function in Excel to create a “live” transposed version of the original data.

Let me know what you think, or if you have any tips or comments about this method.

The post Live Transpose in Excel With an Array Formula appeared first on Spreadsheet Labs.

]]>The post Excel SUMPRODUCT Function appeared first on Spreadsheet Labs.

]]>SUMPRODUCT(array1, [array2], [array3], …)

- array1 = the first array that you want to multiply and add together. This is required
- array2, array3, … = the next 2 to 255 arrays of numbers to multiply and add together. This is optional

A few notes about the function:

- If you have more than one array of numbers and they are not the same size, the function will return the #VALUE! error
- If any arrays do not have numbers, they will be treated as a zero by the function
- If a single array is passed to the function, it will only sum. It will not multiply.

In the image below, sample data and four examples of the SUMPRODUCT function are shown.

Notice that both cells A3 and A4 have a single array in their functions, while cells A5 and A6 have two arrays in theirs.

What do you think the result will be of each of the different functions?

The first function in cell A3 is using only two cells in the SUMPRODUCT function, specifically A1 and B1. So will it multiply the 1 (cell A1) * 2 (cell B1) and return 2, or will it add the two value and return 3?

What about the function in cell A4 that is using four cells in its SUMPRODUCT function? Will multiply the four cells or add them?

And then, what about the functions in cells A5 and A6? What will they return?

Here you can see what the results are.

Is it what you expected? If not, hopefully the explanation below will help you work through the formulas to see how the results were achieved.

Notice that when the SUMPRODUCT function is only passed one array of numbers, it does not multiply the numbers, but it adds them.

The function in cell A3 is passed the values in cell A1 of 1 and cell B1 of 2, so it is adding the 1 and 2 to equal 3.

The function in cell A4 is passed the values in cells A1 through A4 of 1,2,3 and 4. It is adding the four amounts to equal 10.

However, the functions in both cells A5 and A6 are both being passed two arrays, so the function is multiplying and then summing the product of the multiplication.

But how is the function returning the answers of 11 in cell A5 and 94 in cell A6?

Remember cell A5 has the formula of

=SUMPRODUCT(A1:B1,C1:D1).

You may think that it would multiply A1 * B1, multiply C1 * D1, and then add those two results together. Actually what the function is doing is multiplying A1 * C1, and B1 * D1, and then adding those two results together. This results in (1*3) + (2*4), which equals 11.

And what about the function in cell A6? Notice how it also refers to two arrays, the same as the formula in cell A5. The difference is that the arrays in cell A6 are not just referring to one row of data, but to two rows instead.

So the function in cell A6 returns 96, which is the result of (1*3) + (2*4) + (5*7) + (6*8).

To summarize how the function works, if there is more than one array being passed to it is this:

Take the first value in each array and multiply them. Then do the same for each next value in the arrays. Then add them together.

Now you fully understand how to use the SUMPRODUCT function.

But the really big question is, Where is this function useful?

One SUMPRODUCT use can be for creating summaries of data, totalling based on criteria. For example, if you have data showing sales for different locations and colors and want a total of each location, or a total of each color, or a total of each unique combination of location and color, you can use SUMPRODUCT.

See the image below.

In the above image, notice that there are several entries for each location, each color, and also for the unique combination of location and color. For example, “North” is found on six rows in column A, and “Red” is found on seven rows in column B. The combination of “North” and “Red” on the same row is found on four rows.

Now, in typical Excel fashion, there are several ways that you could create those totals. You could make the data into a table, add totals to it, and then filter based on what you needed. You could use SUMIF or SUMIFS. And there are probably other ways that you do it. Let me know in the comments if you know of other ways to create summaries.

What will be considered here, is how to use SUMPRODUCT to create summaries of the data. Here is a summary of the above data based on location.

Here’s a summary of the data based on color.

And finally, here is a summary of the data based on a combination of location and color.

Each of these three summaries of the data are using the SUMPRODUCT function to filter the data and add the amounts based on the criteria.

Here are the same summaries, but showing the actual SUMPRODUCT function.

Did you notice how the SUMPRODUCT is a bit different. For example, one of the SUMPRODUCT function formulas is:

=SUMPRODUCT((E2:E26)*(A2:A26=H2)).

The cell H2 contains the word “North”. An alternate to the above formula could be

=SUMPRODUCT((E2:E26)*(A2:A26=”North”)).

So you can type in criteria, or use cell references as the criteria.

The **first array** is the column that you want to sum, the **second array** is the column that you want to filter on. This formula will filter on one criteria. To filter on more than one criteria, you just need to add more arrays and the filter for each one.

For example, the formula

=SUMPRODUCT((E2:E26)*(A2:A26=”North”)*(B2:B26=”Red”))

will add the amounts in column E that have “North” in column A and “Red” in column B.

SUMPRODUCT is not a commonly used function, but it can be used to multiple and add arrays of numbers. A probably surprising use of SUMPRODUCT is to create filtered subtotals of numbers.

If you have of other ways to use SUMPRODUCT let me know in the comments below.

The post Excel SUMPRODUCT Function appeared first on Spreadsheet Labs.

]]>The post How to Use the Excel CLEAN Function appeared first on Spreadsheet Labs.

]]>CLEAN(text)

- text = string of characters that need non-printable characters removed

Please note, the CLEAN function does not remove all non-printable characters from a string. There are some Unicode characters (127, 129, 141, 143, 144 and 157) that this function will not clean.

So, depending on what non-printable characters are in your data, you may need to use further methods to clean the data you’ve imported. You’ll need to use the SUBSTITUTE function combined with the CLEAN function to clean them.

The cell A1 has the formula “=CHAR(1)&”string”&CHAR(4)”. The CHAR(1) and CHAR(4) are non-printable characters that will be cleaned from the string. Note how result of the formula of “=CLEAN(A1)” in cell C1 shows just the printable text of “string” in the cell.

The post How to Use the Excel CLEAN Function appeared first on Spreadsheet Labs.

]]>The post How to Use the Excel COLUMN Function appeared first on Spreadsheet Labs.

]]>COLUMN([reference])

- reference = The cell or range of cells that you want to have the column numbered returned from. This is optional.

Here are a few notes about the function:

- The reference can’t refer to multiple ranges
- If no range is entered in the function, it assumes that you want to know the column of the cell that has the function
- If you use an array in the reference (by selecting the cell with the COLUMN function, pressing F2, and then CTRL + SHIFT + ENTER), the function will return the column number as a horizontal array
- If the reference is a range of more than one cell, and a horizontal array formula is not used, the function will return the left-most column number

Here you will see some examples of the COLUMN function including using it as a horizontal array formula. The image below shows the results of using the function.

Now, here is the same spreadsheet showing the formulas:

Notice that the three formulas are all different, yet they return the same result.

=COLUMN() returns 1, since the function is located in column 1

=COLUMN(A1) also returns 1, since it is referring to cell A1, which is in column 1

=COLUMN(A1:B1) also returns 1 even though the range is over two columns. This is because it always returns the left-most column.

Now, you will see the difference by using horizontal array formulas.

In the image below, the results of the COLUMN function is shown. There are three more formulas added to help show the comparison.

Here is the formula view of the above spreadsheet. Note that array formulas will not show the curly brace brackets in the cells, but only in the formula bar. As a result, the formulas in cells A4, B4, A5 and B5 all look identical. However, the formulas in A5 and B5 are both entered as horizontal array formulas.

The image below shows how the formula in cell B5 appears in the formula bar with the curly braces to indicate it is a horizontal array formula.

The post How to Use the Excel COLUMN Function appeared first on Spreadsheet Labs.

]]>