fbpx
Search
Close this search box.

All articles with 'VBA' Tag

Extract BOLD portion of a cell in Excel using getBoldText() function

Published on Feb 26, 2024 in Excel Howtos, VBA Macros
Extract BOLD portion of a cell in Excel using getBoldText() function

Use the getBoldText() function in Excel to extract bolded portion of a cell automatically. Saves you time and helps with data cleaning.

Continue »

Number to Words – Excel Formula

Published on Mar 24, 2020 in Excel Howtos, VBA Macros
Number to Words – Excel Formula

Ever wanted to convert numbers to words in Excel? For example, 456,123 becomes four hundred fifty-six thousand one hundred twenty-three.

Microsoft recently introduced LET function to Excel. This allows us to create variables on the fly to use within a formula. I just made a words from number formula using LET function and bit of good old INDEX.

Read on to learn how this all works.

Continue »

Filter as you type [Quick VBA tutorial]

Published on Dec 10, 2019 in VBA Macros
Filter as you type [Quick VBA tutorial]

Filtering a list is a powerful & easy way to analyze data. But filtering requires a lot of clicks & typing. Wouldn’t it be cool if Excel can filter as you type, something like above.

Let’s figure out how to do this using some really simple VBA code.

Continue »

Show difference between cells in status bar – VBA Example

Published on Sep 10, 2019 in Excel Howtos, VBA Macros
Show difference between cells in status bar – VBA Example

We can select a few cells in Excel and quickly see their count, sum etc. in the status bar. Ever wanted to customize the status bar to show something else, say difference? You can use VBA add-ins with application level events to achieve this. In this VBA Example, we will look at how to set up a class module, application event in our personal macro add-in to customize status bar.

Continue »

Play spreadsheet soccer with Excel Penalty Game [VBA]

Published on Jul 4, 2018 in Charts and Graphs, VBA Macros
Play spreadsheet soccer with Excel Penalty Game [VBA]

We love spreadsheets. And of course, once every four years, we also get mad about soccer. So why not merge both of them in to one awesome, frivolous and fun thing: Introducing….

Excel soccer game

The best part is you don’t have to run up to play this. Set your aim and let RANDBETWEEN() decide your fate.

Continue »

One Control Three Cells

Published on Mar 5, 2018 in Excel Howtos, Huis, Posts by Hui
One Control Three Cells

Learn a technique to control multiple cells with 1 Control.

Continue »

Sand Pendulums – Lissajous Patterns in Excel

Published on Apr 3, 2017 in Charts and Graphs, VBA Macros
Sand Pendulums – Lissajous Patterns in Excel

Few days ago, I saw a beautiful homemade science experiment on Sand Pendulums on Bruce Yeany‘s YouTube channel. Go ahead and check it out. It is a cool project to do with your kids.

I will try this experiment with kids during school term holidays around Easter. But first, I wanted to try the simulation in Excel.

Simulating sand pendulum pattern in Excel

Take a look at the final simulation above. This is what we will create in Excel.

Continue »

Kill NULLs – a Simple macro to save time when importing data from SQL Server

Published on Mar 6, 2017 in VBA Macros
Kill NULLs – a Simple macro to save time when importing data from SQL Server

As part of a my ongoing consulting gig, I often run painfully long queries on SQL Server to fetch data. This data obviously ends up in Excel for further analysis. Now, some of these queries return NULL values in several columns (did I tell you that the queries have a gazillion left joins on them, oh yeah, they do). Although technically NULL is nothing, when you import this data to Excel, we get the text value NULL in the cells. And I don’t need these NULL values messing up all the calculations and pivots.

Of course, we can go ahead and use the isnull() SQL function to deal with them at the query level. But since the queries have 100s of columns and used by various teams for different purposes, changing them causes a lot of pain. So I did what any sensible Excel user would do. Just kill those NULLs mercilessly once they are in Excel.

Continue »

Find them and Extract them – VBA Macro

Published on Feb 10, 2017 in VBA Macros
Find them and Extract them – VBA Macro

I started a new consulting gig with NZ Ministry of Business (aside: when I told my daughter about this, she widened her eyes and said ministry of MAGIC!!! ). On my first day, while having lunch in breakout area, I chatted with the gentleman sitting opposite me. We got talking about this and that and eventually the topic turned to What I do at MB. So I told him that I am helping the HR with some data analysis and reporting using Excel & SQL Server. He asks me, “So you must be familiar with Excel object model”. I said, “oh, why yes”. He then asks me, “I have this problem that is bothering me for years. You see, I get a lot of data. And I use Find (Ctrl+F) to find all the cells that contain certain code. But the results are all over the place. I want to know how to extract all the finds to a target worksheet – value & address format.”

I explained him how to do this while chewing mouthfuls of rice & veggies.

But once I am home, I thought, “hey, maybe there are others out in the world who want to do this”.

So here we go.

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 »

Visualizing Financial Metrics – 30 Alternatives

Published on Aug 30, 2016 in Analytics, Charts and Graphs
Visualizing Financial Metrics – 30 Alternatives

Around 2 months back, I asked you to visualize multiple variable data for 4 companies using Excel.  30 of you responded to the challenge with several interesting and awesome charts, dashboards and reports to visualize the financial metric data. Today, let’s take a look at the contest entries and learn from them.

First a quick note:

I am really sorry for the delay in compiling the results for this contest. Originally I planned to announce them during last week of July. But my move to New Zealand disrupted the workflow. I know the contestants have poured in a lot of time & effort in creating these fabulous workbook and it is unfair on my part. I am sorry and I will manage future contests better.

Continue »

Excel Links – Getting used to life in Windy Wellington Edition

Published on Aug 10, 2016 in excel links, personal

So we moved to Wellington, New Zealand few weeks back (on 17th of July 2016, to be precise). After spending first 3 weeks in Jeff’s house and a hotel, we moved in to our rental home over the weekend (on 6th of August). Around the same time, the worst of Wellington winter waved welcome to us. We quickly learned how to stay warm indoors (layers, hot water bottles, rugs and more layers). Kids started going to school few days back and they are loving it. I bought a bike and managed to go out on few rides on the hilly roads of Wellington and found a strange for sale sign too.

For sale: Pony poo and pine cones

Anyhow, Since we didn’t have internet connection until today, I thought I will start by sharing a few Excel links with you. Check them out to get your fix of spreadsheets.

Read on…

Continue »

How to get Maps in to Excel charts & dashboards [Master Class]

Published on Jul 21, 2016 in 3D Maps (Power Maps), Charts and Graphs, Master Class
How to get Maps in to Excel charts & dashboards [Master Class]

This is third episode of our Monthly Master Class.

In this one, you will learn how to get maps in to your Excel workbooks. Understand 5 key techniques for making maps based visualizations in Excel – from regular charts to cell grids to VBA to Power Maps, everything is covered in this intense Master Class.

Continue »

Teach coding to your kids with this maze game [VBA]

Published on Jun 21, 2016 in excel apps, VBA Macros
Teach coding to your kids with this maze game [VBA]

My twins (Nishanth & Nakshtra) are now almost 7. They are super keen to learn how computers work. So the other day, I showed them Code.org where there are several coding exercises disguised as games. They loved those games … err coding exercises. So that got me thinking… why not make a game in Excel that teaches kids simple programming concepts.

So I built a Snowman & Hot Chocolate Maze game. In this post, let’s understand how to build such a game using Excel VBA.

Continue »