# Venn Diagrams in Excel

This post is a testament that readers of this blog are way cooler and enterprising than I am. * Justin*, who I must say, has some really amazing excel skills, contacted me in April with a VBA Script he made that can draw two circle Venn diagrams in excel. He wrote,

*I regularly need to show the intersection between different populations (venn diagrams) and have struggled to find anything useful in XL2000 or XL2003*

*Most examples are static pictures of circles created in a graphics program to which users add labels – hardly ideal*

**While still a WIP – I’ve come up with a simple 2 circle venn tool.**

*It uses drawing objects [msoShapeOval] (nice to get the transparency)
*

I saw the script and was really impressed by the way it worked. I wrote back to him asking if it is ok to share this with the readers on PHD. And he said OK. Ever since I have been wanting to share this wonderful little tool with all of you.

Without further ado…

### Venn Diagrams in Excel

1. First download the Venn diagrams in excel zip file from here [xls version here].

2. Now when you try to open the file, you must enable macros (in excel 2007, you may want to set the security to low and then reopen the file)

3. Click on the big button you see in the first sheet and specify the venn diagram details (how many in each circle, what is the intersection amount)

4. Click the “Draw Venn” button and you have a sparkling venn diagram ready

Once again, I really appreciate * Justin* for putting together such a nice tool and sharing it will all of us. Thank you

PS: If you like this, do say thank you to Justin in comments. I am sure he can take pretty much any amount of appreciation.

### Do you want to be awesome in Excel?

**Here is a smart way to become awesome in Excel**. Just signup for my Excel newsletter. Every week you will receive an Excel tip, tutorial, template or example delivered to your inbox. What more, as a joining bonus, I am giving away a 25 page eBook containing **95 Excel tips & tricks**. Please sign-up below:

Your email address is safe with us. Our policies

### Leave a Reply

Tweetboard Implementations – Download and make your twitter style dashboard today |
Converting Excel to PDF – Everything you need to know |

## 27 Responses to “Venn Diagrams in Excel”

thank you so much Justin & Chandoo

I wondered if there was a non-VBA solution to this, and basically, there is (at least in 2003).

You can use a Bubble chart to draw many overlapping circles.

By default, bubbles in bubble charts are not transparent.

BUT, you can then draw a semi-transparent circle, and paste that over the bubbles.

This thread at Mr Excel

http://www.mrexcel.com/forum/showthread.php?t=370777

which links to this page on John Walkenbach's site

http://spreadsheetpage.com/index.php/tip/creating_a_transparent_chart_series/

was a big help.

John's site implies you can only do it on bar and column charts, but you can actually do it on bubble charts as well, as long as the drawn object you create is itself a circle.

Chandoo - I'd be happy to post more details if that would be useful.

The advantage of this solution is that you can easily and dynamically control the position and size of the circles, and I'm not aware of any limit on the number of circles.

@Gerald.. very good point... but how will you control the exact overlap of circles with bubble charts ? Justin's addin actually calculates how much area of circle1 has to be covered by circle 2 and then places (and sizes) them accordingly.

Chandoo - your's is a very good point too. My manual solution clearly would need some complicated maths to work out the precise overlaps and position the circles accordingly.

Not impossible, but a bit tricky.

Sorry, I hadn't appreciated the complexity of the challenge. Oops !

@Gerald... In excel, the bubble charts are much more lamer than we think they are. You cannot really control anything wrt bubble position or size without resorting to some tricks (like placing very small dummy bubbles to control minimum bubble size etc.) On top, the traditional linear way of thinking fails with excel bubbles. I once spent a whole afternoon trying to create something cool with them only to agonize myself with the limitations of bubble charts. But may be that is because I wanst keen enough to explore them completely.

If you come across some positioning logic that would work, please let us know

Hi,

Should probably add that the tool works better with populations between 5k and 25k

I'll keep tinkering with this - so any feedback on how to make it better much appreciated.

Chandoo - I've kind of set myself a challenge to do this - create a 2 circle solution, which handles the overlap correctly, without VBA. I need to teach myself some maths first - I'll let you know if I manage it.

Gerald:

The xlVenn spreadsheet has a hidden sheet, creatively named 'Sheet1' that has the calculations for the size and relationship for two circles. Might help get you started.

I only stopped (for now) at two circles because I was fascinated in getting it right and spending way too much time investigating a solution (instead of working)

Be keen to see what developes

Cheers,

Justin

Chandoo and Justin...This is a fantastic post. I am constantly amazed and challenged by Excel. It just so happens there is a project I am working on that this may come in handy for. One thing that would be more useful (if possible) is a sort of zoom control so you could work with small populations. Maybe if you set oval 1 to a default size and then had oval 2 change as a percent of the size of oval 1 you could work with very small and very large ranges.

Chandoo...I have been reading your website for about a year now and cannot express the thanks for the knowledge obtained. I build some pretty complex dashboards at work and the visualization techniques have been very helpful in presenting the information in a meaningful and productive manner. Thanks a million...

Nice work Justin! It threw up some errors at first, but after declaring some of the variables it's up and running.

Ian: Which variables?

One day I'll put up an improved version - would like tit to work first time / every time.

It shows a compile error after clicking the Draw Venn button

Hi Alonso,

Post a thread on 'Excel Forum' with the version you're having problems with. I'll take a look and respond there.

Justin

@Alonso: Also, may be you are clicking the draw venn button too fast. First you should enter the data.

@Chandoo

The compile error shows with data

@Justin

The compile error says that can´t find project or library on the DrawVenn_Button_Click sub, selecting the LenDist= variable

version is 03

@Alonso: I think the problem may be with trying to determine the Length of the 'distance from the left pane edge' variable without first converting the input to a string.

In the Sub 'DrawVenn_Button_Click' replace the first 4 lines with the below..

LenDist = Len(CStr(Me.DistFromLeftandTop.Value))

LenIntersect = Len(CStr(Me.Circel1and2Intersect.Value))

LenCircel1 = Len(CStr(Me.Circle1Population.Value))

LenCircel2 = Len(CStr(Me.Circle2Population.Value))

@Chandoo: Apologies for hi jacking the thread - one day I'll put up better version.

Justin

The problem is solved after removing the REF EDIT CONTROL from the references (Appears as MISSING)

Dont know if this affects the rest of the VBA

perhaps you may have seen this applet? - not using Excel

http://www.cs.kent.ac.uk/people/staff/pjr/EulerVennCircles/EulerVennApplet.html

tks

Thanks for this link. This is by far the best tool set seen so far.

Thanks Justine for sharing your macro, You have saved my life!!!!!!!!!!!

This method could well be redundant soon.

J-Walk's example of a Bubble chart in 'Excel 2007 Bible' can be adapted to produce a proportionally correct Venn diagram in a Bubble chart without having to resort to VBA

I'm still playing with it - but will post a workbook example and try my hand at writing up a 'how to'.

[full credit to J-Walk for both inspiration and concise, easy to use examples]

can we have it for 5 set venn diagram

amazing Justin, yousaved my day! thanks a lot!

Thanx Chandoo and Justin. I found a basic Venn diag tool. Is it possible to add more variables, say 3 or 4 to it? Also, any more options for formatting like those found in SmartArt?

Great work, thanks for this...

Thank you so much! Fantastic tool!!!!!!

Thanks a ton.

Can you tell how to draw venn from multiple column excel sheet.