Word clouds are a great way to visually represent text-based data, yet they used to be very difficult to create in Excel without resorting to add-ins or VBA. ☁️
Thankfully, since the advent of Python integration, there's a convenient way.
In the video example, a collection of tourist reviews for London's Madame Tussauds is housed in A3:A52.
In order to generate a word cloud for these in A1, enter =PY( to activate Python mode and use the following code:
Import WordCloud class from wordcloud library
from wordcloud import WordCloud
Fetch reviews from A3:A52 using the xl() function
reviews = xl("A3:A52")
Combine all text from reviews into single string, separated by spaces
all_reviews = ' '.join(reviews[0])
Generate and display word cloud
WordCloud(background_color='white').generate(all_reviews).to_image().show()
For the word cloud to display directly in the cell, it's necessary to switch the Python Output to 'Excel Value' from the dropdown next to the formula bar.
Stop words are excluded by default. These are insignificant words like 'the', 'of', 'to', and 'and'. If you do wish to have them, include stopwords=set() as an additional parameter in the WordCloud class.
There are many other parameters you can take advantage of for greater customisation. A full list is found at https://amueller.github.io/word_cloud....
✄---
By @andrewcharlesmoss
#exceleration #excel #globalexcelsummit
---
The Global Excel Summit is the world's largest gathering of Microsoft Excel users and experts.
Find us on:
🌐 Website: https://globalexcelsummit.com
👔 LinkedIn: / global-excel-summit
🆇 X: https://x.com/ExcelSummit
🤳 TikTok: / globalexcelsummit
📸 Instagram: / globalexcelsummit
🟦 Facebook: / globalexcelsummit
🧵 Threads: https://www.threads.net/@globalexcels...