fbpx

Author Archive

Untrimmable Spaces – Excel Formula

Published on Jan 12, 2017 in Excel Howtos, Learn Excel
Untrimmable Spaces – Excel Formula

Let’s talk about the untrimmable spaces.

We all know that TRIM() removes extra spaces from the beginning, ending and middle of a text.

So for example, if A1 has ” something and    one   more    ”

TRIM(A1)

will give “something and one more”

We can use CLEAN() function to remove non-printable characters (like the ASCII codes 0 to 31).  Of course, SPACE is technically a printable character, so CLEAN() won’t remove spaces.

The untrimmable spaces…?

The other day Sreekanth emailed me a sample of data and asked, “how do I remove the spaces in this list and convert them to numbers?”

Naturally I tried to TRIM().

But the data won’t budge. See above.

Hmm, let’s investigate why.

Continue »

Merry Christmas & Happy New Year 2017 [Holiday Greeting]

Published on Dec 23, 2016 in personal
Merry Christmas & Happy New Year 2017 [Holiday Greeting]

A big, warm & pleasant hello to you.

I wish you a merry Christmas & Happy New Year 2017. May your holidays be filled with joy, togetherness, celebrations and fulfillment. May your new year be filled with hope, energy and awesomeness.

I want to tell you how thankful I am for all your support in this year. Every time you visit our website, read an article, leave a comment, enroll in a course, purchase a product, read one of my books, listen to a podcast episode, watch a video or tell your friends about Chandoo.org, I feel nothing but gratitude, thankfulness and amazement. 2016 has been a remarkable year in our journey and I owe this to you and your support.

Continue »

An odd lookup problem [Formulas]

Published on Dec 6, 2016 in Excel Challenges, Learn Excel
An odd lookup problem [Formulas]

Let’s say you have some employee data in employee name, manager name format. But the data is all in one column, with odd rows containing employee names & even rows containing manager names. Something like above.

And you want to find out who is the boss for a given employee. Say, “Andrea Nichols”.

Your regular MATCH() formula for Andrea over the data range returns wrong answer as it will find first occurrence of Andrea (which in this case happens to be on even row, hence a manager record).

So how would you write the lookup formula?

Continue »

Sorting to your Pivot table row labels in custom order [quick tip]

Published on Nov 29, 2016 in Pivot Tables & Charts

Pivot tables are lovely. But sometimes they are hard to work with. Let’s say you are analyzing some HR data and want to see number of weeks worked in each hour classification.

And you want this.

pivot-table-row-label-order-incorrect

Except, there is a teeny tiny problem.

The sort order on the classification is all messed up.

Here is a quick fix to get custom sort order on your pivot table row labels.

Continue »

Finding the closest school [formula vs. pivot table approach]

Published on Nov 18, 2016 in Excel Howtos, Learn Excel, Pivot Tables & Charts
Finding the closest school [formula vs. pivot table approach]

First a quick personal update: There has been a magnitude 7.8 earth quake in NZ on 14th November 2016 early morning. It is centered in Kaikoura, which is about 250 km away from Wellington. We did feel several shakes and after shocks. It has been an interesting and often scary experience. But my family is safe. I feel very sad for the all the damage and the loss for families in NZ. If you suffered from this quake, My prayers and thoughts are with you.

Yesterday, a friend asked me an interesting question. He has school distance data, like above. He wants to know which is the closest school for each school.

There are a few ways to answer this question. Let’s examine two approaches – formulas & pivot tables and see the merits of both.

Continue »

Can you solve this blood pressure problem? [IF Formula Homework]

Published on Nov 4, 2016 in Formula Challenges, Learn Excel
Can you solve this blood pressure problem? [IF Formula Homework]

Over on Facebook, Kristin asks, Help, my blood pressure is going thru the roof. I can’t seem to solve this blood pressure problem. 

Let’s simplify Kristin’s problem.

You have some data in the format shown above.

And you want to find out the BP category for each reading, using some rules. Read on to solve the problem.

Continue »

How to add a line to column chart? [Charting trick]

Published on Nov 2, 2016 in Charts and Graphs
How to add a line to column chart? [Charting trick]

Let’s say you work in super hero factory as floor manager. You are looking at the recent time sheet data submitted by your underlings and want to know who works more. So you did what any self respecting floor manager does. You made yourself a large cup of hot chocolate, whipped open Excel and created a column chart.

But now, you want to add a line to it at 6:00 PM (or some other arbitrary  point) so you can clearly see which superheros are over working.

So how do you go about it?

Continue »

CP056: So which formulas you should care to learn?

Published on Oct 27, 2016 in Chandoo.org Podcast Sessions
CP056: So which formulas you should care to learn?

In the 56th episode of Chandoo.org podcast, let me answer the chicken and egg question of Excel users. How many formulas should you care to learn?

What is in this session?
In this podcast,

  • Two personal updates
  • 3 legs of formula writing
    • Function knowledge
    • Operators
    • Referencing
  • 6 categories of must-know functions
    • Basic math
    • Conditions
    • Lookups
    • Text
    • Date & time
    • Work specific
  • Closing remarks & resources for you
Continue »

Find first & last date of a sale using Pivot tables [quick tip]

Published on Oct 26, 2016 in Pivot Tables & Charts
Find first & last date of a sale using Pivot tables [quick tip]

Here is a quick Pivot table tip. Let’s say your work at ACME inc. requires some fancy pants analysis of product sales. Imagine looking at below data & trying to find out the earliest & latest date for each product sale.

Of course, we can concoct a version of MINIFS & MAXIFS to answer the question. But why bother, when you can answer the question with just a few clicks.

Continue »

How many formulas should you learn? [Weekend Poll]

Published on Oct 20, 2016 in Learn Excel

Over at twitter, @for_the_moves asks,

That got me thinking. How many functions should you care to learn?

Continue »

Finding if a cell has 7 in it… [Pattern matching in Excel]

Published on Oct 18, 2016 in Learn Excel
Finding if a cell has 7 in it… [Pattern matching in Excel]

Imagine you work at MI5 as a HR officer. You want to find all agents who have license to kill (licence 7). Your data looks like above.

How would you go about it? 

If you filter the list or use FIND() or SEARCH() formulas, you will end up with agents who also have licenses 77, 17 or not7. So how would you solve this problem?

Of course, you do what any smart person does. You summon Excel and ask it nicely by using some wicked pattern matching logic.

Continue »

CP055: “Yes, I am back” edition (and a bonus Excel tip)

Published on Oct 13, 2016 in Chandoo.org Podcast Sessions
CP055: “Yes, I am back” edition (and a bonus Excel tip)

Ladies & gentlemen, its time we revived the much loved Chandoo.org podcast. In the 55th episode, I do a lousy imitation of Arnold Schwarzenegger’s famous “I will be back” and tell you why there was such a long gap between episodes, my plans for reviving our podcast and more.

What is in this session?

In this podcast,

  • Why there was such a long gap between last and this episode
  • What next?
  • How to extract every 6th item from a list?
Continue »

Interactive Decision Tree Visualization in Excel [Trump vs. Hillary in Swing States]

Published on Oct 11, 2016 in Charts and Graphs, Pivot Tables & Charts, VBA Macros
Interactive Decision Tree Visualization in Excel [Trump vs. Hillary in Swing States]

It is election time in USA, and that means there is a whole lot of drama, discussions and of course data analysis. There are tons of cool visualizations published on all the data. Previously, we talked about “How Trump happened” chart.

Today let’s take a look at the beautiful decision tree chart by NY Times explaining what would happen if each of the 10 swing states vote for Democrats or Republicans. Go ahead and look at that chart. And when you are done playing with it, come back.

My first thought after looking at the chart is: Wow, that is cool. I wonder how we can recreate that experience in Excel?

But as you can guess, making a dynamic tree visualization in Excel is pretty hard. You can create a bubble chart mixed with XY chart to show all the nodes of the decision tree, but as this tree has 2^10 nodes at the bottom level (and 2^11-1 total nodes) our chart would look very clumsy and busy.

So, instead of replicating NY Times chart, why not make our own version that explains the data? You can reuse this idea when visualizing outcomes of several what-if scenarios.

Continue »

Currency format Pivot fields with one click [Friday VBA]

Published on Oct 7, 2016 in Pivot Tables & Charts, VBA Macros
Currency format Pivot fields with one click [Friday VBA]

Anyone who has made a pivot table and their grandma knows that formatting them is a pain. Let’s recap the steps to apply one of the most common formats – currency format.

  1. Right click on any value field
  2. Go to Value field settings
  3. Click on “Number Format” button
  4. Choose Currency format
  5. Close the boxes, one after another

Unless you get paid per click, you wont be happy with all those clicks.

Wouldn’t it be cool to just click once and apply most common format to your pivot fields?

Of course you can. Just add oneClickCurrency macro to your personal macros workbook. And then add this to your Home ribbon as a custom button and you have a one click format option for any pivot.

Continue »

How to generate all combinations from two separate lists [Pivot Table Trick]

Published on Oct 4, 2016 in Pivot Tables & Charts
How to generate all combinations from two separate lists [Pivot Table Trick]

Time for a quick but very useful tip. Ever wanted to create all combinations from two (or more) lists? a la Cartesian product of both lists.

Here is a ridiculously simple way to do it.

Continue »