Originally published in July 2013. Updated by Ryan Dube in October 2017.
I’ve always believed that Excel is one of the most powerful software tools out there. It isn’t just the fact that it’s a powerful spreadsheet application. Microsoft Excel itself has such an impressive collection of built-in tools and features. In this article, I plan to show you how powerful formulas and conditional formatting can be, with three useful examples.
We’ve covered a number of different ways to make better use of Excel, such as using it to create your own calendar template, using it as a goals management tool, and other unique ways that you can use it to manage your life. Just read those articles and you’ll see just how powerful Excel can be.
Much of the power really lies behind the formulas and rules that you can write to manipulate data and information automatically, regardless of what data you insert into the spreadsheet.
Digging Into Excel
With the right information, you can create a system that automatically calculates and recalculates results and reports from that raw data. Today, I’d like to dig a little further under the surface and show you how you can use some of the underlying formulas and other tools to make better use of Excel.
Cool Conditional Formatting With Formulas
One of the tools that I think people just don’t use often enough is Conditional Formatting. If you’re looking for more advanced information on conditional formatting in Excel, make sure to check out Sandy’s article on formatting data in Excel with conditional formatting.
With the use of formulas, rules, or just a few really simple settings, you can transform a spreadsheet into an automated dashboard that shows you a lot about the information in the spreadsheet at just a glance.
To get to Conditional Formatting, you just click on the Home tab, and click on the “Conditional Formatting” toolbar icon.
Under conditional formatting, there are a bunch of options. Most of these are beyond the scope of this particular article, but the majority of them are about highlighting, coloring or shading cells based on the data within that cell. This is probably the most common use of conditional formatting – doing things like turning a cell red using logical less-than or greater-than formulas. Brad Jones describes how to use a lot of these in his article on creating an Excel Dashboard — well worth checking out if that’s your goal.
One of the lesser used conditional formatting tools is the icon sets option, which offers a great set of icons you can use to turn an Excel data cell into a dashboard display icon.
I discovered this once I upgraded Microsoft Office and used conditional formatting in Excel for the first time.
I checked out the icon sets and saw these cool LED indicator lights that I had only really seen before in some of the factory automation displays I’ve programmed in the past. When you click on “Manage rules”, it’ll take you to the Conditional Formatting Rules Manager. Depending on the data you selected before choosing the icon set, you’ll see the cell indicated in the Manager window, with the icon set you just chose.
When you click on “Edit Rule…”, you see the dialog where the magic happens. This is where you can create the logical formula and equations that will display the dashboard icon you want. In my example, I monitor time spent on different tasks versus my budgeted time. If I’ve gone over half my budget, I want a yellow light to display, and if I’m over budget, I want it to go red.
As you can see, I’m not really budgeting my time too well. Almost half of my time is spent way over what I’ve budgeted.
Time to refocus and better manage my time!
Look Up Items With the VLookup Function
Okay, maybe that isn’t crazy enough for you. Maybe you aren’t so excited about simple logical formulas turning lights on and off. If you like using more advanced Excel functions, then I’ve gone another one for you.
You’re probably familiar with the VLookup function, which lets you search through a list for a particular item in one column, and return the data from a different column in the same row as that item. Unfortunately, the function requires that the item you’re searching for in the list is in the left column, and the data that you’re looking for is on the right, but what if they’re switched?
In the example below, what if I want to find the Task that I performed on 6/25/2013 from the following data?
In this case, you’re searching through values on the right, and you want to return the corresponding value on the left – opposite the way VLookup normally works. If you read Excel pro-user forums you’ll find a lot of people saying this isn’t possible with VLookup and that you have to use a combination of Index and Match functions to do this. That’s not entirely true.
You can get VLookup to work this way by nesting a CHOOSE function into it. In this case, the formula would look like this:
What this function means is that you want to find the date 6/25/2013 in the lookup list, and then return the corresponding value from the column index. In this case, you’ll notice that the column index is “2”, but as you can see the column in the table above is actually 1, right?
That’s true, but what you’re doing with the “CHOOSE” function is manipulating the two fields. You’re assigning reference “index” numbers to ranges of data – assigning the dates to index number 1 and the tasks to index number two. So, when you type “2” in the VLookup function, you’re actually referring to Index number 2 in the CHOOSE function. Crazy, eh?
So now the VLookup uses the Date column and returns the data from the Task column, even though Task is on the left. Now that you know this little tidbit, just imagine what you can do!
If you’re trying to do other advanced data lookup tasks, be sure to check out Dann’s full article on finding data in Excel using lookup functions.
Insane Nested Formulas to Parse Strings
As you can see, I’m trying to get a little crazier as we go, because I know there are some of you out there thinking, “…well that’s not crazy at ALL!!” I know, your standards are high. I’m trying to live up to them. Here’s one more crazy formula for you.
There may be cases where you either import data into Excel from an outside source that consists of a string of delimited data. Once you bring in the data, you want to parse that data out into the individual components. Here’s an example of name, address and phone number information delimited by the “;” character.
Here’s how you can parse this information using an Excel formula (see if you can mentally follow along with this insanity):
For the first field, to extract the leftmost item (the person’s name), you would simply use a LEFT function in the formula.
This searches the text string from A2, finds the “;” delimiter symbol, subtracts one for the proper location of the end of that string section, and then grabs the leftmost text to that point. In this case, that’s “Ryan”. Mission accomplished.
Nesting Excel Formulas
But what about the other sections? Well, to extract the parts on the right, you need to nest multiple RIGHT functions to grab the section of text up until that first “;” symbol, and perform the LEFT function on it again. Here’s what that looks like for extracting the street number part of the address.
It looks crazy, but it’s not hard to piece together. All I did is took this function:
And inserted it into every place in the LEFT function above where there’s an “A2”. This correctly extracts the second section of the string.
Each subsequent section of the string needs another nest created. So now you just take the crazy “RIGHT” equation you had created for the last section, and then pass that into a new RIGHT formula with the previous RIGHT formula pasted into itself wherever you see “A2”. Here’s what that looks like.
Then you take THAT formula, and place it into the original LEFT formula wherever there’s an “A2”. The final mind-bending formula looks like this:
That formula correctly extracts “Portland, ME 04076” out of the original string.
To extract the next section, repeat the above process all over again. Your formulas can get really loopy, but all you’re doing is cutting and pasting long formulas into itself, make long nests that work really well!
Yes, this meets the requirement for “crazy”, but let’s be honest…there is a much simpler way to accomplish the same thing with one function. Just select the column with the delimited data, and then under the Data menu item, select Text to Columns. This will bring up a window where you can split the string by any delimiter you want.
In a couple of clicks you can do the same thing as that formula above…but what’s the fun in that?
Getting Crazy With Excel
So there you have it. The above formulas prove just how over-the-top a person can get when creating Excel formulas to accomplish certain tasks. Sometimes those formulas aren’t actually the easiest (or best) way to accomplish things. Most programmers will tell you to keep it simple, and that’s as true with Excel formulas as anything else.
Were these formulas and techniques wild enough? Do you have any amazing formula tricks of your own that make up your Excel super-user toolbox? Share your input and feedback in the comments section below!
Image Credit: kues/Depositphotos