Home » excel » graph – Generating a tree in Excel

graph – Generating a tree in Excel

Posted by: admin March 9, 2020 Leave a comment

Questions:

I have some data in an Excel sheet that represents a hierarchy. As the tree is large and reviewing the data is becoming quite a task, I am trying to generate a pictorial representation of the tree. Excel doesn’t seem to have built-in support for tree generation. What would be the best way to generate the tree from within Excel? Are there add-ons available?

Suggestions related to tree generation using other tools would also be welcome. (I have already tried the org chart option in Visio. For some reason, it could not open my Excel file.)

How to&Answers:

Maybe you could use Excel Treeview control in a useform, you can find a great tutorial here. i have never used it personaly though.

Seems like VisualStudio 2010 allow you to do things a little smarter : you can have a look here. But i don’t know enough this part of MS to help you anymore on this way.

And yet, the subject was discussed on another forum pointing to other third party tools.

Answer:

There is a solution for both node-link tree or treemap. But it do require another tool since drawing this on Excel only would be very difficult if not impossible.

I propose to use the Funfun Excel Add-in which allows you to use JavaScript directly in Excel. With the capability of using JavaScript, you could make use the powerful libraries like D3.js or HighChart.js so that drawing tree chart would be much easier.

Here are two examples of generating trees in Excel.

enter image description here

enter image description here

I used D3.js in the first example and Hightchats.js in the second example. I made those two examples in Funfun online editor and then linked them to my Excel. You could check the code on the links below.

https://www.funfun.io/1/edit/5a36aaf145ac15144af3fe1e

https://www.funfun.io/1/edit/5925013604ce702ccfb22b0b

Here is what you need to do to link these samples to your Excel.

1). Insert the Funfun add-in from Office Add-ins store

enter image description here

2). Create a new Funfun or load a sample from Funfun online editor.

enter image description here

3) Have fun 🙂

Disclosure: I’m a developer of Funfun

Answer:

I have used the ActiveX Treeview Control on Excel sheets, and it is fine. HOWEVER, depending on your version of Windows and which Security Updates you have, it may or may not work. I developed an application using one, for a major City bank, but we had to re-work entirely when certain upgrades were applied company-wide. After a very long and useless discussion with Microsoft in the US, we got nowhere at all. If you Google “excel treeview security upgrades” you’ll find various discussions. I suggest using 3rd party, though I can’t suggest one.