Excel Price List With VLOOKUP and MATCH Function

You can create order forms and price lists in Excel, and automatically show a price when a product is selected in the order form. But what happens if you want to give some customers special pricing, or offer sales pricing occasionally? Here’s how to customize your Excel price list with VLOOKUP and MATCH.

Continue reading “Excel Price List With VLOOKUP and MATCH Function”

Old Items Appear in Pivot Table Drop Downs

After you update the source data for a pivot table, and refresh the table, some of the old data might still appear in the pivot table drop downs.

For example, you changed a product name from Whole Wheat to Whole Grain, and now both names show up in the pivot table’s Product drop down.

There are written steps and a video below, that show how to fix the problem.

old data in pivot table drop down
old data in pivot table drop down

Prevent Old Items in Excel 2007

You can prevent old items from being retained in an Excel 2007 pivot table, by changing on of the pivot table options

  1. Right-click a cell in the pivot table
  2. In the pop-up menu, click PivotTable options
  3. Click the Data tab
  4. In the Retain Items section, select None from the drop down list.
  5. Click OK, then refresh the pivot table.

OldItems02

The old items will disappear from the pivot table drop downs, and won’t appear again.

Clear Old Items in Excel 2003

To prevent old items in Excel 2003 pivot tables, you can use programming to change the MissingItemsLimit setting.

Or, you can manually clear the old items, by following these steps:

  1. If you manually created groups that include the old items, ungroup those items.
  2. Drag the pivot field that contains old items out of the pivot table. Also remove it from any other pivot tables that use the same pivot cache.
  3. Refresh the pivot table.
  4. Drag the pivot field back to the pivot table.

This will clear the existing old items, but won’t prevent more from appearing later.

Watch the Video

To see the steps to change the retain items setting in Excel 2007, you can watch this short video.

______________

For more information on Pivot Tables, see the Pivot Table Tutorials on the Contextures Website.

______________

Excel Movies Database Filter Macro

The Oscar nominations will be announced next Tuesday, February 2nd (oh, Groundhog Day, that was a good movie).

In honour of the occasion, I’ve updated my Excel Movie Database sample file.

Excel Movie Database

I included some movies from the Top 250 Movies list at the IMDb website. You can add movies from your DVD collection, or your Netflix list.

Then use the selection boxes to see movies from a specific category, and/or featuring your favourite actor.

In the previous version, you could only choose Category OR Actor, and now you can choose one or both. (Exciting, I know!)

Or, clear both criteria cells, to see all the movies.

Select a movie category
Select a movie category

Download the Sample File

You can download the Excel movies database file from the Contextures website. It’s in Excel 2003 format, and zipped.

The file contains macros, so you’ll have to enable those to make the file work.

The Perfect Computer

I couldn’t find any movies about Excel, to add to the Excel movies database, but computers play a leading role in several movies. You might remember HAL 9000, from “2001: A Space Odyssey”.

HAL: Let me put it this way, Mr. Amor. The 9000 series is the most reliable computer ever made. No 9000 computer has ever made a mistake or distorted information. We are all, by any practical definition of the words, foolproof and incapable of error.

Yes, that was the dream, way back in 1968, when they made “2001: A Space Odyssey”. Over 40 years later, we haven’t even come close to achieving that goal! Well, maybe it’s not the computers’ fault – the users might be part of the problem.

Random Draw Sinner

Congratulations to Alex Kerin, whose name I selected in the random draw for the Excelerator Quiz giveaway. Here’s his name at the top of the list, after I used the RAND function, and sorted the Rand column in ascending order.

Giveaway20100129

Alex’s prize is a 23″ monitor, plus a keyboard and mouse, courtesy of the PowerPivot team. Thanks to everyone who participated, and to the PowerPivot team, and Megan at Ignite Social Media, who organized the giveaway.

__________

Excel AutoFilter Shows Filter Mode

It’s Price Book publishing week for one of my clients, and we’ve been making lists, and checking them twice. Or 3 or 4 times, or more!

When comparing the new prices to the previous prices, an Excel AutoFilter comes in handy. You can select the same product or model in each workbook, and easily compare item details.

Yes, the widget prices went up a bit this year, so that’s why the assembled parts cost a bit more.

There are written steps and a video below, that show how to use the AutoFilter feature, and workarounds for a problem

Record Count in the Status Bar

Sometimes when you select records with an AutoFilter, the record count appears in the Status Bar, at the bottom left. In this example, I was working with a small table, with 50 records, and only one column had a formula.

I selected File Folder in the Product column, and the Status Bar showed that 3 of the 50 records contained that product. So far, so good.

Record Count in the Status Bar
Record Count in the Status Bar

Status Bar Shows Filter Mode

Then I added another record to the table, and selected a different product from the AutoFilter drop down list. This time the Status Bar showed the rather unhelpful message, “Filter Mode”, instead of the record count.

FilterMode02

Excel 2007 seems to handle this better, but in Excel 2003, and earlier versions, you might see “Filter Mode” if there are more than 50 formulas in the list.

When you apply an AutoFilter, the formula recalculate. If there are lots of formulas to calculate, Excel shows a “Calculating %” message in the Status Bar, so you’ll have something to entertain you while you wait.

Unfortunately, the “Calculating %” message interferes with the record count message in the Status Bar. If the record count message is interrupted, it shows the “Filter Mode” message instead.

You can’t change this behaviour, but there are a couple of workarounds that you can use to find the record count.

Use AutoCalc Instead

If the Status Bar shows “Filter Mode”, you can get the record count from the AutoCalc feature instead.

  1. Right-click on the Status Bar
  2. In the pop-up menu, click Count Nums
  3. Click on the column heading for a column that contains numbers (and no blank cells within the list)

You’ll see the count of visible numbers in the AutoCalc area of the Status Bar.

AutoCalc area of Status Bar
AutoCalc area of Status Bar

Use the SUBTOTAL Function

If you’d rather have the record count show up automatically, you can use the SUBTOTAL function. It ignores the filtered rows, and calculates based on the visible rows only.

For example, with numbers in column D, this formula, with 2 as the first argument, will calculate the COUNT of visible numbers:

=SUBTOTAL(2,D:D)

Use the SUBTOTAL Function
Use the SUBTOTAL Function

If you want to count items in a column that contains text, use 3 as the first argument, and subtract 1 from the result, to account for the heading cell.

=SUBTOTAL(3,B:B)-1

Watch the Excel AutoFilter Video

In this very short video you can see my Excel AutoFilter experiment, and watch the Filter Mode message appear in the Status Bar.

There are no ruggedly handsome math teachers in this video, but it’s fun-filled and action-packed!

There are more Excel AutoFilter Tips on my Contextures website.
___________

Excel Codes Change to Scientific Notation

Let’s call this installment, “The Mysterious Case of the Vanishing Parts.” (Read carefully — that’s paRts, not paNts.)

Strange Formatting

Last Friday, I was working on a client’s Excel file, revising some VBA code.

The code splits a list of manufacturing parts into multiple columns, strips a couple of characters off the front of the part name, and copies the results to another column.

What Happened?

It seemed to be going well, until I got an email from my client, saying that some of the part numbers looked funny.

He included a screenshot, and indeed, those part numbers did look odd. Here’s an example, using some dummy data.

ScientificNotation01

Scientific Notation Formatting

“Aha!” I thought. (Yes, I actually talk to myself like that. 😉 )

Those parts were all numbers, so Excel just formatted them as Scientific Notation.

I could simply format the column as General at the end of the macro, to make them look right.

Unfortunately, it wasn’t that simple. When I clicked on one of the affected cells, the formula bar showed 220 as the actual part number.

So, if I changed the formatting to General, 220 is the part number that would be copied to other cells, later in the macro.

That would cause problems, because all the codes should have two digits, then a letter, and then numbers

Scientific Notation Formatting
Scientific Notation Formatting

Why Part Number Was Changed

After a bit more investigation, I found that the original part number wasn’t 220, it was 22E1.

Close, but manufacturing might be adversely affected if Excel starts making up new part numbers!

Because the original part number (22E1) started with numbers, followed by the letter E, then another number, Excel interpreted it as a number in Scientific Notation.

It converted that number to Excel’s style of Scientific Notation (exponential) formatting – 2.20E+02.

I’m sure Excel was trying to help, but that creates problems, just as it does when Excel changes 6-10 to a date for you, without asking.

The workaround to this unsolicited help is to force the data to be recognized as text, as Microsoft explains in its article:

Text or number converted to unintended number format in Excel.

Fixing the Problem

In my client’s macro, instead of formatting the parts column after copying the part names, I added an apostrophe at the start of each part name.

The apostrophe doesn’t show on the worksheet, but it tells Excel that the cell contents are text.

That solution left the “E” parts in their original format, and the problem was solved.

VBA Code Revision

Here’s the formula that is added in the VBA code:

.Range(“D2?).Formula = “=IF($A2<>$A1,””‘”” & $U2,””””)”

ScientificNotation03

Scientific Notation Explained

If you’d like to know how scientific notation works, in fairly simple terms, you can read this article: Scientific Notation

And for an even shorter and simpler description, here’s a short video in which a math teacher explains scientific notation.

And remember to do your homework!

_______________

Excelerators Giveaway for Excel Power Users

Excelerators_promo2Are you an Excel power user? Answer a few quick questions at the Excelerators Quiz site, and find out how you rate. You could even win a nice prize here at the Contextures blog!

The team at PowerPivot for Microsoft Excel 2010 created the Excelerators Quiz, and to make the challenge more exciting, they’re sponsoring a giveaway here on the Contextures blog (for USA residents only).

The blog giveaway prize has a total value of over $250, and will include a Dell ST2310 23 inch flat panel monitor, keyboard, and mouse. You’ll be even more powerful if you have those tools!

Enter the Giveaway

What does it take to be an Excel power user? What kind of quiz questions would you create? We’ll create our own Excel quiz here in the comments. Maybe it’ll be better than the Excelerators Quiz!

To enter the giveaway, after you take the Excelerators Quiz, come back here and add a comment. In your comment:

  • Create your own unique question for the Excelerators Quiz.
  • Make your question multiple choice, with the correct answer as one of the four options.

You can contribute more than one question, but only your first question will be entered in the giveaway draw.

The Giveaway Rules

  • You must be a legal resident of the Unites States of America.
  • To enter, submit an original Excelerators quiz question in the comments below, with the correct answer as one of the 4 multiple choice options
  • The comment must be submitted before the deadline of 12:00 noon (Eastern Time) on Thursday, January 28th, 2010
  • One entry per person – any additional entries will be deleted from the draw
  • A random draw will select the winner from all valid entries.
  • Winner will be notified by email, so please provide a valid email address. This will not be publicly visible, but will be shared with the contest organizers at Ignite Social Media, so they can contact the winner to arrange delivery.

The Alpha Geek Challenge

The PowerPivot team has also launched an Alpha Geek Challenge for more advanced excel geeks. Donald Farmer will host a PowerPivot competition in which the Grand Prize winner will receive an all-expenses paid trip to the 2010 Microsoft BI Conference in New Orleans, LA in June.

After you finish the Excelerators Quiz, and the giveaway contest here, see how you do in the Alpha Geek Challenge!
________

Excel OFFSET Function-Fish for Data

That’s my dad in the picture below, proudly holding the catch of the day. He tried to teach me how to fish, but without much success. (Worms…ewwww.)

my dad with his catch of the day
my dad with his catch of the day

Fishing with OFFSET Function

This week someone asked me to explain the Excel OFFSET function, saying “Please teach me to fish.” That’s when it struck me that using OFFSET is similar to fishing.

  • When you’re fishing, you can dip into a pond with a bamboo pole and a small hook, or head out to sea, and cast a large net. Or you can fish the way we do in Canada, through a small hole in the ice, but that’s another story. (There’s a video at the end of this article.)
  • With the Excel OFFSET function, you can pull data from a single cell nearby, or a large range of cells off in the distance.

The OFFSET function is useful when you want to make the data selection adjustable.

For example, if a February date is entered in cell A2, you can sum the February expense column. If a March date is entered, sum the March expenses instead.

Your Fishing Equipment

To make the OFFSET function work, you’ll tell it 3 things:

  1. The starting point
  2. Where to go from there
  3. How big a range to capture (optional)

The OFFSET syntax is: OFFSET(reference,rows,cols,height,width)

  1. The reference is the starting point.
  2. The rows and cols tell OFFSET where to go from the starting point. It can go up or down a specific number of rows, and left or right a specific number of columns.
  3. The height and width set the size of the range. It can be as small as 1 row and 1 column (a single cell) or much bigger.

For example, this OFFSET formula would return the January total, in cell B6:
=OFFSET(A1,5,1,1,1)

  1. The starting reference is cell A1.
  2. From there, it goes down 5 rows, and right one column, to cell B6.
  3. The selected range size is 1 row tall and 1 column wide.
Excel OFFSET function example with arrows
Excel OFFSET function example with arrows

Baiting the Hook

Instead of typing all the values in the formula, you can use one or more cell references, to make the OFFSET formula flexible. In this example, all the totals are in row 5, so that number won’t change.

However, the month number is typed in cell G1, so you could use that cell to set the number of columns to offset. Change the formula so G1 is the cols argument.

=OFFSET(A1,5,G1,1,1)

OFFSET03

Now, if you change the month number to 3 in cell G1, the March total will be returned.

Casting the Net

Instead of pulling the result from a single cell, you could use OFFSET with the SUM function, to select a range with multiple cells, and calculate the total.

For example, this formula would calculate the total for the February expenses.

=SUM(OFFSET(A1,1,G1,4,1))

  1. The starting reference is cell A1.
  2. From there, it goes down 1 row, and right 2 columns, to cell C2.
  3. The selected range size is 4 rows tall and 1 column wide – C2:C5.

OFFSET04

Other Fish to Fry

I like the OFFSET function, and use it to create dynamic ranges in some of my workbooks.

There are alternatives to using the Excel OFFSET function, such as the Excel INDEX Function.

There’s an interesting discussion of the merits of each function on Dick Kusleika’s Daily Dose of Excel Blog: New Year’s Resolution: No More Offset.

Ice Cold Fish

I’d rather stay inside and work on OFFSET formulas, but ice fishing is popular here in Canada. This video makes the sport look almost appealing.

_____________________