This is a guest post by Daniel Ferry of Excelhero.com.
Have you ever wanted to fetch live stock quotes from excel? In this post we will learn about how to get stock quotes for specified symbols using macros.
One method that has worked well for my clients can be implemented with just a few lines of VBA code. I call it the ActiveRange.
An ActiveRange is an area on a worksheet that you define by simply entering the range address in a configuration sheet. Once enabled, that range becomes live in the sense that if you add or change a stock symbol in the first column of the range, the range will automatically (and almost instantly) update. You can specify any of 84 information attributes to include as columns in the ActiveRange. This includes things such as Last Trade Price, EBITDA, Ask, Bid, P/E Ratio, etc. Whenever you add or change one of these attributes in the first row of the ActiveRange, the range will automatically update as well.
Sound interesting, useful?
In this post, you can learn how to use excel macros to fetch live stock quotes from Yahoo! Finance website. It is also going to be a crash course in VBA for the express purpose of learning how the ActiveRange method works so that you can use it yourself.
Download Excel Stock Quotes Macro:
Click here to download the excel stock quotes macro workbook. It will be much easier to follow this tutorial if you refer to the workbook.
Background – Understanding The Stock Quotes Problem:
The stock information for the ActiveRange will come from Yahoo Finance. A number of years ago, Yahoo created a useful interface to their stock data that allows anyone at anytime to enter a URL into a web browser and receive a CSV file containing current data on the stocks specified in the URL. That’s neat and simple.
But it gets a little more complicated when you get down to specifying which attributes you want to retrieve [information here]. Remember there are 84 discreet attributes available. Under the Yahoo system, each attribute has a short string Tag Code. All we need to do is to concatenate the string codes for each attribute we want and add the resulting string to the URL. We then need to figure out what to do with the CSV file that comes back.
Our VBA will take care of that and manage the ActiveRange. Excel includes the QueryTable as one of its core objects, and it is fully addressable from VBA. We will utilize it to retrieve the data we want and to write those data to the ActiveRange.
Before we start the coding we need to include two support sheets for the ActiveRange. The first is called “YF_Attribs”, and as the name implies is a list of the 84 attributes available on Yahoo Finance along with their Yahoo Finance Tag Codes. The second sheet is called, “arConfig_xxxx” where xxxx is the name of our sheet where the ActiveRange will reside. It contains some configurable information about the ActiveRange which our VBA will use.
All of the VBA code for this project will reside inside of the worksheet module for the sheet where we want our ActiveRange to be. For this tutorial, I called the sheet, “DEMO”.
Writing the Macros to Fetch Stock Quotes:

Press ALT-F11 on your keyboard, which will open the VBE. Double click on the DEMO sheet in the left pane. We will enter out code on the right. To begin with, enter these lines:
Private rnAR_Dest As Range
Private rnAR_Table As Range
Private stAR_ConfigSheetName As String
Always start a module with Option Explicit. It forces you to define your variable types, and will save you untold grief at debugging time. In VBA each variable can be one of a number of variable types, such as a Long or a String or a Double or a Range, etc. For right now, don’t worry too much about this – just follow along.
Sidebar on Variable Naming Conventions
Variable names must begin with a letter. Everyone and their brother seems to have a different method for naming variables. I like to prefix mine with context. The first couple of letters are in lower case and represent the type of the variable. This allows me to look at the variable anywhere it’s used and immediately know its type. In this project I’ve also prefaced the variables with “AR_” so that I know the variable is related to the ActiveRange implementation. In larger projects this would be useful. After the underscore, I include a description of what the variable is used for. That’s my method.
In the above code we have defined three variables and their types. Since these are defined at the top of a worksheet module, they will be available to each procedure that we define in this module. This is known as scope. In VBA, variables can have scope restricted to a procedure, to a module (as we have done above), or they can be global in scope and hence available to the entire program, regardless of module. Again we are putting all of the code for this project in the code module of the DEMO worksheet. Every worksheet has a code module. Code modules can also be added to a workbook that are not associated with any worksheet. UserForms can be added and they have code modules as well. Finally, a special type of code module, called a class module, can also be added. Any global variables would be available to procedures in all of these. However, it is good practice to always limit the scope of your variables to the level where you need them.
In that vein, notice that the three variables above are defined with the word Private. This specifically restricts their scope to this module.
Every worksheet module has the built-in capability of firing off a bit of code in response to a change in any of the sheet’s cell values. This is called the Worksheet_Change event. If we select Worksheet from the combo box at the top and Change in the other combo box, the VBE will kindly define for us a new procedure in this module. It will look like this:
![]()
End Sub
Notice that by default this procedure is defined as Private. This is good and as a result the procedure will not show up as a macro. Notice the word Target near the end of the first line. This represents the range that has been changed. Place code between these two lines so that the entire procedure now looks like this:
The Heart of our Excel Stock Quotes Code – Worksheet_Change()
ActivateRange
If Worksheets(stAR_ConfigSheetName).[ar_enabled] Then
If Intersect(Target, rnAR_Dest) Is Nothing Then Exit Sub
If Target.Column <> rnAR_Dest.Column And Target.Row <> rnAR_Dest.Row Then
PostProcessActiveRange
Exit Sub
End If
ActiveRangeResponse
End If
End Sub
That may look like a handful but it’s really rather simple. Let’s step through it. The first line is ActivateRange. This is the name of another sub-procedure that will be defined in a moment. This line just directs the program to run that sub, which provides values to the three variables we defined at the top. Again, since those variables were defined at the top of the module, their values will be available to all procedures in the module. The ActivateRange procedure gives them values.
Next we see this odd looking fellow:
If Intersect(Target, rnAR_Dest) Is Nothing Then Exit Sub
All this does is check to see if the Target (the cell that was changed on the worksheet) is part of our ActiveRange. If it is the procedure continues. If it’s not, the procedure is exited.
The next line checks to see if the cell that was changed is in the first column or first row of the ActiveRange. If it is, the post processing is skipped. If the change is any other part of the ActiveRange, another sub-procedure (defined below) is run to do some post processing of the retrieved data, and then exits this procedure.
If the cell that changed was in the first column or the first row, the program runs another sub-procedure, called ActiveRangeResponse, which is also defined below. ActiveRangeResponse builds the URL for YF, deletes any previous QueryTables related to the ActiveRange, and creates a new QueryTable as specified in our configuration sheet.
That’s it. The heart of the whole program resides here in the Worksheet_Change event procedure. It relies on a number of other subprocedures, but this is the whole program. When a change is made in the ActiveRange’s first column (stock symbols) or its first row (stock attributes), ActiveRangeResponse runs and our ActiveRange is updated.
Understanding other sub-procedures that help us get the stock quotes:
So let’s look at those supporting subprocedures. The first is ActivateRange:
stAR_ConfigSheetName = “arConfig_” & Me.Name
Set rnAR_Dest = Me.Range(Worksheets(stAR_ConfigSheetName).[ar_range].Value)
Set rnAR_Table = rnAR_Dest.Resize(1, 1).Offset(1, 1)
Worksheets(stAR_ConfigSheetName).[ar_YFAttributes] = GetCurrentYahooFinancialAttributeTags
End Sub
Again, all this does is give values to our three module level variables. In addition it builds the concatenated string of YF Tag Codes required for the URL. It does this by calling a function that I’ve defined at the very bottom of the module, called GetCurrentYahooFinancialAttributeTags.
The next subprocedure is ActiveRangeResponse:
Dim vArr As Variant
Dim stCnx As String
Const YAHOO_FINANCE_URL = “http://finance.yahoo.com/d/quotes.csv?s=[SYMBOLS]&f=[ATTRIBUTES]”
vArr = Application.Transpose(rnAR_Dest.Resize(rnAR_Dest.Rows.Count – 1, 1).Offset(1))
stCnx = Replace(YAHOO_FINANCE_URL, “[SYMBOLS]”, Replace(WorksheetFunction.Trim(Join(vArr)), ” “, “+”))
stCnx = Replace(stCnx, “[ATTRIBUTES]”, Worksheets(stAR_ConfigSheetName).[ar_YFAttributes])
AddQueryTable rnAR_Table.Resize(UBound(vArr)), “URL;” & stCnx
End Sub
Notice that here we have variables defined at the top of this procedure and consequently their scope is limited to this procedure only. This means that we could have the same variable names defined in other procedures but those variables would not be related to these and would have completely different values.
Next notice that we have defined a constant. This is good practice, as it forces us to specify what the constant value is by naming the constant. I could have just used the value where I later use the constant, but then the question arises as to what is this value and where did it come from. Here I have named the value, YAHOO_FINANCE_URL, removing all doubt as to its purpose.
The next line is this:
vArr = Application.Transpose(rnAR_Dest.Resize(rnAR_Dest.Rows.Count - 1, 1).Offset(1))
and it deserves some explanation. Let me back up by saying that whenever we write or read multiple cells from a worksheet we should always try to do it in one go, rather than one cell at a time. The more cells involved the more important this is. Otherwise we pay a massive penalty in processing time. One of the best optimization techniques available is to replace code that loops through cell reads/writes and replace it with code that reads/writes all the cells at once. It can literally be hundreds to thousands of times faster.
Here we are interested in getting the list of all of the stock symbols in the first column of the ActiveRange. So how do we get them in one shot? We use something called a variant array. Notice that we defined vArr at the top of this procedure. A variant array is a special kind of variable that holds a list of values and it DOES NOT CARE what variable types those values are. This is important when retrieving data from a sheet because the data could be numbers, text, Boolean (True or False), etc. Variants are powerful, but they are much slower than other variable types, such as a Long for numeric data for example. However, in the case of retrieving or writing large chunks of data from/to a sheet the slight penalty of the variant is dwarfed by the massive increase in the speed of data transfer.
It’s very simple to retrieve range data (regardless of the size) into a variant array. All you do is:
v = range
where v is defined as a variant and range is any VBA reference to a worksheet range. And magically all of the values in that range are now in v. Note that v is not connected to the range. A change in any of v’s values does not propogate back to the range, and likewise a change to the range does not make it’s way to v all by itself. v will ALWAYS be a two-demensional array. The first dimension is the index of the rows, the second dimension is the index of the columns. So v(1,1) will refer to the value that came from the top left cell in the range. v(6,9) will hold the value that came from the cell in the range at row 6 and column 9.
For most circumstances this two-dimensional format is fine. But we are only retrieving one column of stock symbols. The procedure will still give us a two-dimensional array, with the column dimension being only 1 element wide. This is a shame because VBA has a wonderful function called Join that allows you in one step (no loop) to concatenate every element of an array into a string. You can even specify a custom string to delimit (go in-between) each element in the output string. The problem is that Join only works on single dimensioned arrays 🙁
But there’s always a way, right? We can use the Application.Transpose method on the 2-D array and presto we get a 1-D array. The rest of the line just specifies what range (the stock symbols) to grab.
The next two lines are:
stCnx = Replace(YAHOO_FINANCE_URL, "[SYMBOLS]", Replace(WorksheetFunction.Trim(Join(vArr)), " ", "+"))
stCnx = Replace(stCnx, "[ATTRIBUTES]", Worksheets(stAR_ConfigSheetName).[ar_YFAttributes])
Again a handful, but all we are doing here is replacing the monikers, [SYMBOLS] and [ATTRIBUTES] in the YAHOO_FINANCE_URL constant with the list of stock symbols (delimited by a plus sign) and the string of attributes.
In the final line of the procedure:
AddQueryTable rnAR_Table.Resize(UBound(vArr)), "URL;" & stCnx
we are running another subprocedure called, AddQueryTable and we are telling it where to place the new QueryTable and providing the connection string for the QueryTable, which in this case is the YF URL that we just built.
Nothing unusual happens in the AddQueryTable sub. It just deletes any existing AR related QueryTables and adds the new one according to the options in the configuration sheet.
The PostProcessActiveRange sub is interesting:
If rnAR_Dest.Columns.Count > 2 Then
Application.DisplayAlerts = False
rnAR_Table.Resize(rnAR_Dest.Rows.Count).TextToColumns Destination:=rnAR_Table, DataType:=xlDelimited, Comma:=True
Application.DisplayAlerts = True
Worksheets(stAR_ConfigSheetName).[ar_LocalTimeLastUpdate] = Now
End If
End Sub
Processing Yahoo Finance Output using Query Table & Text-Import Utility:
As mentioned before the data from YF comes back as a CSV file. The QueryTable dumps this into one column. If you were only retrieving one attribute for each stock this would be fine as is. However, two or more attributes is going to result in unwanted commas and multiple attribute values squished into the first column of the QueryTable output. Unfortunately this is poor design by Microsoft, especially when you consider that the QueryTable does not behave like this when it is retrieving SQL data or opening a Text file from disk. You can actually specify this operation to be a text file and it will properly spread the output over all of the columns. To do so, you specify the disk location as being the URL of the YF CSV file, but as Murphy would have it, it’s unbelievably slow and pops up a status dialog as it slowly retrieving the CSV. Using the URL instruction instead of the TEXT instruction at the beginning of the connection string is incredibly fast in comparison, but dumps all of the data into the first column.
So what to do? We’ll just employ Excel’s built-in TextToColumns capability and bam, our data is where we want it.
Our finalized stock quotes fetcher worksheet should look like this:

Download Excel Stock Quotes Macro:
Click here to download the excel stock quotes macro workbook. It will be much easier to follow this tutorial if you refer to the workbook.
Final Thoughts on Excel Stock Quotes
The ActiveRange technique is quite versatile. It can be implemented with other data sources such as SQL, or even lookups to other Excel files, or websites.
In this example it provides a nice way to easily track whatever stocks you may have interest in and up to 84 different attributes of those stocks. You can enable and disable the activeness of the ActiveRange on the fly. You can set the AR to AutoRefresh the data at periods that you set or to not refresh at all.
This is a basic implementation. For example, changing the AutoRefresh setting will have no effect until a new QueryTable is built. That won’t happen until you also add or change a stock symbol or add or change an attribute. An easy enhancement would be to add a little code to the arConfig_DEMO code module to respond to changes to the ar_AutoRefresh named range cell.
Another enhancement would be to eliminate the slight flicker of the update by moving the QueryTable destination to the arConfig_DEMO and then doing the TextToColumns with the destination set to the DEMO sheet. In an effort to simplify this tutorial I have left these easy enhancements as an exercise for you to implement.
Have a question or doubt? Please Ask
Do you have any questions or doubts on the above technique? Have you used ActiveRange or similar implementations earlier? What is your experience? Please share your thoughts / questions using comments.
I read Chandoo.org regularly and will be monitoring the post for questions. But you can also reach me at my blog:
Further References & Help on Excel Stock Quotes [Added by Chandoo]
- Fetching Stock Quotes using Research Pane
- Stock Portfolio Tracker using Google Docs
- QueryTable Object Model & Properties
- Using QueryTable to Generate Dynamic Reports
- Yahoo Finance API Documentation & Example
Excel Hero is dedicated to expanding your notion of what is possible in MS Excel and to inspiring you to become an Excel Hero at your workplace. It has many articles and sample workbooks on advanced Excel development and advanced Excel charting.

















106 Responses to “Waterfall Charts using Excel”
First of all, great post. Second, an extra thought on the usefulness of waterfall charts in general:
Waterfall charts are best employed when a stacked bar (or, as I cringe, a pie chart) won't suffice because some of the "contributors" contribute negatively. This example is very helpful to get the basic technique down, but some extra math and series would need to be added to accommodate common waterfall chart applications (cash flow analyses, marketing mix, etc.).
Jon's add-in does this, I think (at least, based on the screenshots). It can be done without an add-in, but it takes a moment to get the math down on what you're referring to as 'Base Values' in this example (the transparent spacer series).
This is an incredibly useful program. In my job, I have found several uses for it already!
Thanks Aaron for taking th time to educate us!
Hi, nice tutorial, thanks Aaron and Chandoo. This also works in 2003, although some of the stages are very slightly different.
One possible improvement - some of the connecter lines may look as if they are slightly out of step with the blocks - in the final chart the one between "north" and "east" looks slightly too high. I also got this when I followed the tutorial. You can play around with borders for the element series - either turn them off completely, or make them the same colour as the fill colour, and play around with the line weight. If that doesn't work, consider adding in a small number to the connector values to offset them slightly.
Hi, That's a nice way to draw waterfalls. For a different take on waterfall charts, you might look at my post on how to draw them using scatter charts at;
http://www.edferrero.com/Blog/tabid/106/EntryID/16/Default.aspx
Thanks for the post. We use them all the time. As noted in an earlier comment, it would be great to adjust this so it can handle negative values, and color-code the negatives in red and positives in green.
For easier math and handling negative values:
Three colums of data, labels then the start and end points
In the chart wizard choose Line Chart and the 1st option - upper left hand corner of the dialog
Double Click on one of the Lines - select Format Data Series Select Options: Up Down Bars
Select each line; Patterns, Line, None
And Bob's your uncle.
This approach does not have Chandoo's nice connector lines - but it is easy to implement.
Great add, Bob. Two more things:
1) The up/down bars are based on the first and last series provided. You can add the line connectors like Aaron's chart has by adding a series for each line segment to the middle of the data table. Could be an easier way to do this, but hey... this worked.
2) I didn't like that the first datapoint (2008 in my example) and last (2009) were the same color as up bars. I see those as absolutes, and the up/down bars should be for the changes (Chg1-4). So, I added an absolute volume series (named Vol) and changed its chart type to Bar.
3) Using the same trick that Aaron explains, you can also add data labels. I didn't.
Bob's (in rows instead of columns):
Label 2008 Chg1 Chg2 Chg3 Chg4 2009
Start 0 100 110 100 55 0
End 100 110 100 55 125 125
Mine:
Label 2008 Chg1 Chg2 Chg3 Chg4 2009 Note
Start 100 110 100 55 UpDown
Vol 100 125 Type=Bar
Line 100 100 Type=Line
Line 110 110 Type=Line
Line 100 100 Type=Line
Line 55 55 Type=Line
Line 125 125 Type=Line
End 110 100 55 125 UpDown
Obviously, more cumbersome to set up but...
Grrr... attempt #2...
Bob's (in rows instead of columns):
_Label __2008 __Chg1 __Chg2 __Chg3 __Chg4 __2009
_Start _____0 ___100 ___110 ___100 ____55 _____0
___End ___100 ___110 ___100 ____55 ___125 ___125
Mine:
_Label __2008 __Chg1 __Chg2 __Chg3 __Chg4 __2009 Note
_Start ______ ___100 ___110 ___100 ____55 ______ UpDown
___Vol ___100 ______ ______ ______ ______ ___125 Type=Bar
__Line ___100 ___100 ______ ______ ______ ______ Type=Line
__Line ______ ___110 ___110 ______ ______ ______ Type=Line
__Line ______ ______ ___100 ___100 ______ ______ Type=Line
__Line ______ ______ ______ ____55 ____55 ______ Type=Line
__Line ______ ______ ______ ______ ___125 ___125 Type=Line
___End ______ ___110 ___100 ____55 ___125 ______ UpDown
OK, guys: I didn't get it at all, but God knows I've tried to !!
I can't download the sample @the office, but I'm wondering if you can lead me thru this example: I have a list of countries on col C, values for each Line Of Business on clos D and E, and total in col F.
I'd like to create the waterfall chart to show how each country contributes to the total.
How do I do thaT??
thanks !!
PLease disregard my previous post, I think i hadn't enough caffeine on me.....i totally did it !!
@Martin: Cool. Here is to Coffee and passionate users like you. Cheers!
thanks master !!
I've actually gone a step further, and combined the chart with a data validation filter, and the result was really impressive, a dynamic waterfall chart, without a single macro line !!!
Commenting this with a colleague form Finance, he mentioned that in this case (showing info from offices and getting to a region total), waterfall might induce to a confusion, as one might be tempted to understand that a certain office's numbers is based on the previous shown, and reluctantly, i had to agree with that vision.
Still, I love the results !!!
Rgds,
Martin
Outstanding tips. I never experiment that much. Thanks for this nice tutorial. Next time I definitely teach my younger brother about it. Again thanks.
I wish I could use waterfall charts with pivot tables and Dynamic number of data elements (which is why I use pivot tables). My main issue is related to data elements. I have charts I update every month for every project. So each project has its own set of charts (same charts with each project). However, each project might have 0 to 12 data elements. And every month the number of data element can change for each project. I do not see how I could do waterfall charts without a lot of work when I change the number of data points.
@Brian... One idea: you can take the above tutorial and create waterfall chart with 12 bands and then save it as template. Then next time you need to use a waterfall chart, just use it and set the blank elements as NA().
Another option is to try Jon's utility. It is a pretty good tool and takes care of most of this work automatically.
[...] please welcome Aaron Henckler as the Member of Month. Aaron has contributed a beautiful tutorial on creating waterfall charts using excel during the last month. He taught me few cool charting tricks through that. Thank you [...]
on http://www.hichert.com/de/software/exceldiagramme/55
there are some examples for waterfall charts.
Diagramm 675 (Rätsel 3)
Diagramm 657, 656, 655
if you mouse-click on the chart you can download the corresponding xls-file.
have also a look on the new poster HI-SUCCESS-Rules for information design.
brochure in english
http://www.hichert.com/downloads/media/broschueren/brochure_2008_en.pdf
poster preview
http://www.hichert.com/de/shop/poster/203
[...] to Aaron, who guest posted about excel waterfall charts in August. In august, I have turned my attention towards the pivot tables and wrote Excel Pivot [...]
This is the best tutorial on Waterfall Charts!
@Chrisham.. no arguments there, Aaron really did a splendid job on this one.
Hi Chandoo,
Another firsts of its kind though there are many who claim to have prepared the first free version of waterfall charts and want their name to be entered in Guinness World Records but I've seen none.
My request is please update this note as you best know waterfall charts (WC)are best employed when a stacked bar or a pie chart won’t suffice because some of the “contributors” contribute negatively but above chart did not cover this aspect and also add some more templates of revised watefall charts
Thanks and best regards
Fakhar
PS: Thanks again for always taking time out from your very busy schedule for quick/timely response to our queries
To add another wrinkle, any thoughts on how to go from negative to less negative to positive numbers? We have a quarterly loss, trying to go from the GAAP to non-GAAP adjusted, which goes from a loss of 500 to loss of 100 to profit of 400 for example.
@Jeff... I am not sure, but waterfalls are not ideal for showing negative bars. But I have a weird suggestion. Try changing the axis settings so that horizontal axis crosses vertical axis at -600 instead of 0.
Jeff:
See my comment from August 11, 2009 and Seth's followup the same date. Nice simple approach that accomplishes your objective. An excellent alternative is to get Jon Peltier's Waterfall add-in - it does everything.
Great thanks Aaron,
This works really well for constantly incrementing series (ie. when you are always moving up as you move right)
It can be pretty easily adapted for changes which involve declining values by altering the base to always be the lowest number in the two connector series and using the absolute value for the Element Value.
I've come up with an improved template that handles negative values just fine. I'll see if I can figure out how to post it.
Hmm, can't find an easy way to share the file. If anyone's interested, let me know. Basically, you paste in three columns: labels, before, and after. THe excel I made up witll produce a waterfall chart with a starting and ending total, and provide green/red step bars, with dotted line connectors, for positive and negative deltas, respectively.
Todd, coul you please mail me your template? i would appreciate it: martin.tobon at gmail
Thanks
@Todd
Have a look here
http://chandoo.org/forums/topic/posting-a-sample-workbook
Thanks! So, the link is: http://rapidshare.com/files/416227351/Cheese_Waterfall_Template.xlsx
The filds highlighted in gray are all formulas, so don't need to be touched. It's not the cleanest (I should be able to condense it a bit), but it works for now.
Thanx! This is really helpfull and it works great in 2003. I was adjusting my graphs in Illustrator to get the message right :$ This is much more convenient and looks the way it should look.
Hi Todd,
The link is gone ; can you please re load, thanks!
Thanks
Have been using waterfalls for a long time.. this is very useful
For animated waterfall charts you can try http://www.fusioncharts.com/powercharts/charts/waterfall/ (This is one of the best product created by an Indian guy when he was 17 year old). I also checked his latest speech at Nasscom Emergeout Kolkata on 28th, 2011. They have clients like Google, Facebook, US Gov etc.
Thought of mentioning it here :), great work!
GREAT tutorial. Was able quickly replicate and then adapt for my uses.
Hello Aaron,
The post is Nice & useful.
But only for ascending data.
If any fall will come into account then this template would not support.
So if possible then Guide for Any fall between the raising Data.
Hi
Great post this and thanks for that. However I'm stuck in the last step and cannot link the label value to the element value. I'm using Excel 2010. Any help ?
Spoke too soon ! I was typing in the label box instead of the address box ! Works perfectly now !
Please please explain how to display negative values that contribute to the total
tnx in advance
Can this be done in Excel 2002 (what my company has). It seems to fall down for me in step 3, as there doesn't appear to be an option in Excel to convert the series to a line.
This just made my life a whole lot easier today. Thanks so much for sharing. Some of us have NO talent for this type of thing and when someone like me can make this work...all I can write is: May Many Good Blessings Fall Upon You!
Thank you so much for putting on web these easy to follow and clear instructions on creating waterfall charts. I have just done two and it was quite simple process.
Will come back for more tutorials!
Hi Todd, could you please re-upload your waterfall chart to deal with negative value?
Thank you a lot!
Hi Todd - Can you re update your waterfall chart? I am attempting to chart negative values in the midst of positive values and am having a hair raising experience.
Thanks so much!
Hi Todd
Could you please repost oyour waterfall chart. I am attempting to chart some negative values in the midst of postivie values. It is truly a hair raising experience.
Thanks much
Tina - please see comments 6 and 7 above.
This is cool! Thank you so much for sharing. Of all the approaches I explored, Aaron's is the easiest to understand.
GREAT post! I used to be a consultant and had this macro automatically built into my powerpoint program. I'm in a new job now and was so happy to find this tutorial to be able to show this kind of analysis again. Thanks!!
Can you post an example excel file of this tutorial with waterfall ups and downs showing the connector lines? How do you lay it out I cannot get it to work and keep connector lines despite a 3 columns attempt and a few cups of coffee
Cheers Chandoo and Co!
@Callan
Did you download the file in the section above
Download the Waterfall Chart Template:
Please download the waterfall chart template from here [.zip version here]
One extra hack I did on this feature was add a mechanism to arrange the columns in order from greatest to least without using vba. I used a combination of a unique_id, the max() function and the vlookup() function. I also set the series label dummy to be 20% of the biggest bar height or a minimum of n. I am using this as part of a display for an input page--the chart reorganizes and relabels with all sorts of different scales. I uploaded a file here: http://www.kaahlsfiles.com/excel/
This was very useful and well explained. I followed the steps and did it all myself.
Thanks heaps.
Chandoo - I am using Excel 2010. Was able to navigate the tutorial without a hitch until the end. I cannot get Step 9 to work. Any advice?
@Chrs
"Click a third time on the edge of the box that appears and then type the equals sign “=”. Now go back to your data table and click on the cell of the Element Value that you want appear in the label. Then press enter."
What this should say is Select the labels for the series, then select an individual label by selecting it again. With just an individual label selected, type a formula in the Formula Bar =$A$10 (Change to suit)
Press enter.
there is not any critical plus and minus data for water fall chart so if its possible then plz add some increasing and decreasing value typ chrat....and thanks for ur tutorial..
Superb stuff. Always wanted to know how to do this. very much appreciated.
I used to to these kind of charts by myself before, but it took me a lot of time... My company has just installed an excel add-in, which allows you to make a rather nice and very easy to make waterfall chart; it's called Upslide (www.upslide.net), and it's rather great!
Great tutorial. Had to fiddle about to display negatives properly (subtracting them from the base)- but looks good. Thanks for taking the time to post this.
I don't know why companies never really teach you how to use the basic software you are provided with; I always feel like an XL dummy, but this waterfall diagram trick is pretty nice and worked for me. I have seen business development folks reduced to drawing them in powerpoint, which takes ages and if you need to make a change that causes some sweat and tears. Now I, a mere R&D guy, can get nice value proposition waterfalls for projects and change them painlessly too. Thanks for the post!
Hi chandoo,
I have a two row and 7 column data and i have followed the steps as per the tutorial.
But i am not able to implement 3rd step while doing it my one of the data vanish. I tried it with all colors, and ultimately my chart got blank.
Thanks
I've been running charts like this for a couple of years in Excel 2002. I have it set up as a template for others in my prior department to use in their presentations. It's quite versatile and works for them well...but the labels all fail in Excel 2007. I've got labels that are not manually linked as described above, but rather I've created addtional series to hold the labels. The Y value is the Y value of the series I'm labeling, and the x-value is the TEXT version of the gap number I want to label. Then I set the label to show the x-value. Since the x values are text, they align with the other series' x axis and it has been working flawlessly. Any way to automate labeling like this in Excel 2007? Shy of an add-in?
Try this site, http://www.waterfall-chart.com/
You enter your data, and receive a waterfall as an Excel file.
Besides, the labels are nicely handled.
Great explanation.
You may want to try, too if you have to create many waterfalls or create perfect waterfalls fast including negatives.
http://lacs.xtreemhost.com
Wow, this was the most helpful and easy to follow set of directions I have ever found! Thank you so much!!
I wanted to automate this process so wrote a little sub to take care of it. However it won't handle negative values or a falling waterfall chart (only rising). They are on my todo list.
[code]Sub WaterfallChart()
Dim i As Integer
Dim sum As Double
Dim base As Double
On Error GoTo Err1:
Dim x
x = Selection.Value
ThisWorkbook.Sheets.Add
Range("a1").Activate
Range("A1").Value = "Axis Labels"
Range("b1").Value = "Base Values"
Range("c1").Value = "Element Values"
Range("d1").Value = "Label Spaces"
For i = 1 To UBound(x)
ActiveCell.Offset(0, 3 + i).Value = "Connector " & i
Next i
Range("a2").Activate
base = 0
For i = LBound(x) To UBound(x)
ActiveCell.Value = x(i, 1)
If i LBound(x) Then
ActiveCell.Offset(0, 1).Value = base
End If
ActiveCell.Offset(0, 2).Value = x(i, 2)
If i = 1 Then
ActiveCell.Offset(0, 4).Value = x(i, 2)
Else
ActiveCell.Offset(0, 2 + i).Value = base
ActiveCell.Offset(0, 3 + i).Value = x(i, 2) + base
End If
ActiveCell.Offset(0, 3).Value = 20
base = base + x(i, 2)
ActiveCell.Offset(1, 0).Select
Next i
ActiveCell.Value = "Total"
ActiveCell.Offset(0, 2).Value = base
ActiveCell.Offset(0, 3).Value = 20
ActiveCell.Offset(0, 3 + UBound(x)).Value = base
'Creating the Chart
Columns("A:A").Select
Range(Selection, Selection.End(xlToRight)).Select
Columns("A:H").EntireColumn.AutoFit
Range("a2", Range("a2").End(xlDown).Offset(0, 3 + UBound(x))).Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlColumnStacked
ActiveChart.SetSourceData Source:=Range("a2", Range("a2").End(xlDown).Offset(0, 3 + UBound(x)))
ActiveChart.PlotBy = xlColumns
ActiveChart.Axes(xlValue).MajorGridlines.Select
Selection.Delete
'Create Connectors
For i = 4 To UBound(x) + 3
ActiveChart.SeriesCollection(i).Select
ActiveChart.SeriesCollection(i).ChartType = xlLine
With ActiveChart.SeriesCollection(i).Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
End With
With ActiveChart.SeriesCollection(i).Format.Line
.Visible = msoTrue
.Weight = 0.25
End With
With ActiveChart.SeriesCollection(i).Format.Line
.Visible = msoTrue
.DashStyle = msoLineSysDash
End With
Next i
'remove legend and hide data series
ActiveChart.Legend.Select
Selection.Delete
ActiveChart.SeriesCollection(1).Select
Selection.Format.Fill.Visible = msoFalse
Selection.Format.Line.Visible = msoFalse
ActiveChart.SeriesCollection(3).Select
Selection.Format.Fill.Visible = msoFalse
Selection.Format.Line.Visible = msoFalse
'Apply Data Labels
ActiveChart.SeriesCollection(3).ApplyDataLabels
For i = 1 To UBound(x) + 1
ActiveChart.SeriesCollection(3).Points(i).DataLabel.Select
Selection.Formula = "=" & ActiveSheet.Name & "!R" & i + 1 & "C3"
Next i
Exit Sub
Err1:
MsgBox ("An error has occurred")
Exit Sub
Err2:
MsgBox ("Non-numeric data")
End Sub[/code]
I should have noted that data is entered in the following fashion:
North 20
South 10
East 40
West 30
Then select the data and run the Sub.
great article!
Seen a pre build waterfall chart builder that is really handy
http://www.excelwithcharts.com/topic7.html
go check it out!
this is AWESOME ... simply AWESOME
tx,
//andie
....and here we have some extreme waterfalls...like Iguaçu, Niagara, Victoria...lol...
http://www.hichert.com/en/consulting/exhibits/65
BOOM!
2012 Budget Bridge in picture form. Thanks Man!!!!
Brilliant! I really liked the waterfall chart! Will be coming back for more!
Thanks a bunch!
Thank you, Thank you. I spent hours trying to figure out how to fix my data labels for a waterfall I had cloned. Finally, I found this article and the part that says...
"Click a third time on the edge of the box that appears and then type the equals sign “=”. Now go back to your data table and click on the cell..."
There's no way anyone could discover that on their own!!
Wow.. never thought there's a tool to make me easier to analyze the growth of my company..
thanks a lot!! you're such a great help!
Check out this video:
http://www.youtube.com/watch?v=m2_wxkv2djg
Thank you so much! This is a wonderful tutorial and very clear even for an excel-challenged person such as myself!
It's really helpful! It helps me to answer my boss' question :p
THankss a lott
Thanks a lot.. Extremely useful post..saved me a lot of time and trouble.
How could I show more visually the third component of the waterfall chart is heavily dependent on the first and second?
I am trying to 'build a story' that the starting point (jump off point) for this year to next (final number) is dependent on three main components A, B and C. But C is dependent on success of A and B. So while the waterfall chart shows that A, B and C are component of from getting from this year to the next but it does not show the relationship between A and B with C.
Any idea how to do this more visually and powerfully?
Thanks!
[...] I just G**gled, Excel Waterfall Chart.... http://peltiertech.com/WordPress/exc...bridge-charts/ Excel Waterfall Chart - Tutorial and Template - Learn how to make waterfall charts using MS Excel | ... Create an Excel Waterfall Chart - YouTube Create Excel Waterfall Chart I hope that helps. [...]
How to you get the waterfall chart to work when the variable goes below the x axis? Lets say you are looking at how sales have translated into negative profits. You have the main sales bar and progressively with expense categories it goes below the line. The series that goes below the line will be part of the same series that you are removing in previous items e.g cost of sales to create the floating effect. Therefore I am left with nothing below the line as that series is artifically removed. Hopefully that makes sense.
@Ian
You have to add extra series just to cater for the negatives
Hey Chandoo,
This is a great example of using the classic set up for the waterfall chart while adding the connectors. This is actually the first time I have seen connectors used in the waterfall.
Thanks for sharing.
Hi, thanks for the post it's helped me create something more meaningful than what I was using previously. I'm stuck on something though, I'm using Excel 2007 and trying to add the horizontal lines between certain points on the stacks that show up as dotted on your chart. Can anyone advise how I can go about adding these using the options in Excel?
Cheers
Andrew
Feel free to use the waterfall chart template I created and let me know your feedbacks:
http://www.alainblattmann.com/index.php/excel/waterfall-chart-bridge-chart
Regards,
Alain
Thanks, Chandoo. Very useful article. Now I better understand how it works. But I found add-in. I made several templates with different configuration of charts and use it. Look at this http://fincontrollex.com/?page=products&lang=en
[…] - Thanks to Aaron Henckler at Chandoo.org for creating an excellent tutorial on waterfall chartsii - Thanks to Rob Bovey at AppsPro for creating a very useful add-in for labeling […]
If you have Excel 2013, try this one out
http://office.microsoft.com/en-nz/store/waterfall-chart-WA104068937.aspx?queryid=7ecf1b58-1265-4fef-be37-17dacbafd66f&css=excel&CTT=1
It's free and seems to handle all the weird cases.
Thanks guys, this really helped me in understanding and creating a good waterfall graph.
I'm just dropping by to let you know, that I've visited this post numerous times to help me with with my waterfall charts.
Thank you so much!
[…] Excel Waterfall Chart - Tutorial and Template - Learn how to make waterfall charts using MS Excel | … http://www.contextures.com/excelwaterfallchart.html Excel Waterfall Charts (Bridge Charts) - Peltier Tech Blog If you insert columns for the extra periods (rather than add them to the end) your charts will update automatically to the new columns. […]
Hi,
It was really helpful data. alothough it was difficult to implement on mulitple data but managed to do that.
Thanx>>>>>>
saurabh gupta
thanks! this helped me a lot
Thanks guys 🙂 its 2nd July, 2014 and this article is still very relevant and helpful!
Took a little reading up but I managed to edit it and expand it to cover more range, awesome!
Great help, my boss ask me to prepare and it was easy.
Phenomenal tutorial, worked perfectly and looks great!! It's sad that it takes so many steps to make this work in Excel, but the steps you laid out make such a better waterfall than the other tips I've seen elsewhere...
Thanx a lot aaron
I was struggling with some data and was not satisfied with the presentation, made it in waterfall today.
Wil b able to sleep tonite 😉
thanx again
Thank you for the post. Everything works great with the tutorial but when I decide to insert another row into the table (e.g., if I was to add another region to the above table) the corresponding chart breaks in that the connector with the new bar is not visible and I can't seem to find a way to create it. I end up recreating the chart from scratch. Any help would be greatly appreciated.
Excellent post. I have used waterfall chart many times in the past but automatic update of connectors was really useful. Thanks
A really nice step by step way of producing a waterfall chart. It all went well when I had positive values , however, once I had a negative value, the relative bar was shown below the X axis. Any solution for this ?
Hi Chandoo,
This waterfall chart doesn't work for negative values. How do you show a negative value?
Matt.
@Matt
That is a basic waterfall chart.
Negative values must be handled using a separate series just for the negative components
I'd suggest that you either:
1. Have a look at:
http://peltiertech.com/excel-waterfall-charts-bridge-charts/
or
http://www.contextures.com/excelwaterfallchart.html
2. Use Excel 2016 which has waterfall charts built in.
@Matt. Please see my comment from Aug 11, 2009 (6th comment from the top above). Nice simple way to handle waterfalls including negative values. The following comments from Seth adds some nice enhancements. Of course, Jon Peltier's utility is the best.
Many thanks. Excellent post. It was really useful for me.
Thank you!! This is very well explained and visually useful 🙂 helped me a lot! Thanks again!!
Great Explanation. Keep it up
Also see More robust waterfall chart taking care of Negative Values and diff color for negative values at
https://eduqfa.com/ultimate-waterfall-chart-excel/
Dear Chandoo
Could you kindly send me the waterfall chart in pdf format by email please.
Would be of great help
Best regards
Srinivasan H, Mumbai