
I was toying with the idea of creating a tag cloud in excel – as a form of new visualization, this could be useful when you have medium amounts of data (eg: 50-300 rows) and you want to emphasize on what is important and what is not. I would imagine using a tag-cloud,
- When you are listing features of your software
- When you are listing your sales figures across top 1000 cities of your country
- When you are analyzing visitor data to your web start up
My goal is to generate a tag cloud from a selected data table (with just 2 columns, one with text to display, the other with any number on it) as shown below:

Download and play with a sample tag cloud visualization I have created
Since anything related to changing cell formats is not possible using functions, I had to write a VBA Macro (a subroutine that you would write in your excel sheet to achieve a task). The logic is simple:
1. Read the selected table and create 2 arrays, 1 with tags and another with the numeric data
2. Select an empty cell in the work book (I choose E10)
3. For each item in tags array:
– Add text to the selected cell
– set its font size based on normalized value between 6 and 20
The code is shown below:
Sub createCloud()
‘ this subroutine creates a tag cloud based on the list format tagname, tag importance
‘ the tag importance can have any value, it will be normalized to a value between 8 and 20On Error GoTo tackle_this
Dim size As Integer
size = Selection.Count / 2
Dim tags() As String
Dim importance()ReDim tags(1 To size) As String
ReDim importance(1 To size)Dim minImp As Integer
Dim maxImp As Integercntr = 1
i = 1For Each cell In Excel.Selection
If cntr Mod 2 = 1 Then
taglist = taglist & cell.Value & “, ”
tags(i) = cell.Value
Else
importance(i) = Val(cell.Value)
If importance(i) > maxImp Then
maxImp = importance(i)
End If
If importance(i) < minImp Then minImp = importance(i) End If i = i + 1 End If cntr = cntr + 1 Next cell ' paste values in cell e10 Range("e10").Select ActiveCell.Value = taglist ActiveCell.Font.size = 8 strt = 1 For i = 1 To size With ActiveCell.Characters(Start:=strt, Length:=Len(tags(i))).Font .size = 6 + Math.Round((importance(i) - minImp) / (maxImp - minImp) * 14, 0) .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With strt = strt + Len(tags(i)) + 2 Next i Exit Sub tackle_this: ' errors handled here 'MsgBox "You need to select a table so that I can create a tag cloud", vbCritical + vbOKOnly, "Wow, looks like there is an error!" End Sub
This code is totally reusable. Just right click on the sheet name at bottom & select “view code”. In the VBA Editor create a new module (Menu > Insert > module) and Paste the above code there. Go back to your excel sheet and select a 2 columned data table and run the createCloud macro. The cloud will be created and pasted in cell E10. You can change this by modifying the line Range(“e10”).Select.
Download the above code and an example in an excel
Happy charting 🙂

















6 Responses to “A quick personal update”
Thank you for the personal update. It was quite encouraging and a breath of fresh air in my Inbox. Take care and stay safe.
David
Doctors advise:
Virus obstructs lungs with thick mucus that solidifies.
Consume lot hot liquids like tea, soup, and sip of hot liquid every 20 min
Gargle w antiseptic of lemon, vinegar, & hot water daily
It attaches to hair/clothes detergent kills it, when come from st go straight shower
Hang dirty clothes in sunlight/cold overnight or wash immediately.
Wash metal surfaces as it can live on them 9 days
Do not touch hand rails
Do not smoke
Wash hands foaming 20 sec every 20 min
Eat fruit/veg and up zinc levels.
Animals do not spread it
Avoid common flu
Avoid eat/drink cold things
If feel sore throat do above immediate as virus is there 3-4 days before descends into lungs
Would love help with my database mgt in excel.
Thanks for being thoughtful of us.
BTW How do you track your expenses/income in excel? Can you share the worksheet please.
Stay safe you and your family, best wishes.
Thanks for the update and happy to know that you and family are doing good. A 21 day lockdown has now been announced in India (I live around Kolkata) so it's uncertain times ahead. I check up on your wonderful articles often and will do so even more regularly now. Stay safe and God bless.
Hi from Argentina, I follow you for a lot of years now. We here are in a quarantine for 2 or 3 weeks, because the pandemia.
Excel is also my passion and I came here looking for a Num2Words formula, but in spanish. If anyone have it, please let me know.
Best regards.
Pablo Molina
La Rioja - Argentina
I'm glad to have your personal update. I'm from India & following you for so many years. Cheers to have any further personal update.