Excel Animation without Macros!

Posted on November 30th, 2010 in Charts and Graphs , Learn Excel - 37 comments

Today we will learn an interesting animation technique that ONLY uses, … wait for it …, Excel Formulas. That is right, we will use simple formulas to animate values in Excel.

Intrigued? Confused? Interested?

First see these Excel animation demos:

Animated icons & fill-color

Animated Icons & Cell Fill Color in Excel - Demo

Animated In-cell Charts

Animated Incell charts - Excel

 

Click here to download the workbook with these examples.

 

What is the secret sauce behind this animation?

Take 1 portion of crushed basil leaves, 2 portions of  grounded roasted coffee beans and mix them with hot water. Add enough sugar and throw it away. :P

Now, come back to your excel workbook and use circular references to generate the animation effect.

Understanding how Circular References & Iterative Calculation Mode work

In order to get this animation, you should be familiar with two excel magic spells – Circular References & Iterative Calculations. In simple terms,

Circular Reference: is when a cell refers to itself in the formula. For eg. in cell A1, if you write =A1+1, it is a circular reference. The reference can be both direct or in-direct (ie you can refer to cell B1, which refers to A1 again).

Iterative Calculation: If a cell has circular reference, excel can quickly go in to infinite loop (not the place where Apple is head-quartered). To avoid this, we use iterative calculation mode. When you enable this mode, excel solves the cell references only a certain number of times.

Here is an excellent guide on circular references.

How to enable iterative calculation mode?

Simple, go to Excel options > Formulas and then select iterative mode. Change the number of iterations to a large value (so that we can see some animation). Like this:Enable Iterative Calculation mode to get Circular References work

How to use Circular References & Iterative Mode for Animation?

It doesn’t take a lot of coffee to conclude that using circular references & iterative mode of calculation, we can increment a cell value from 1 to 100 (or 4000, if you fancy).

Assuming you want to increment the value in A1 from 0 to 100, and A2 is used to control the animation (ie if you type “Yes” in a2, only then we increment the values).

In cell A1, we write =IF(A2=”yes”,IF(A1>=100,A1,A1+1),0)

If iterative mode is enabled, when you enter yes in cell A2, you can see the value in A1 going from 0 to 100, very fast.

Now, if you change the formula to =IF(A2=”yes”,IF(A1>=4000,A1,A1+1),0), you can see the cell value in A1 going up from 0 to 4,000 in a few seconds.

But, what about animation?!?

Now that we have the cell A1 changing its value when we want, we just need to link this with conditional formatting to get some magic.

For eg. you  can apply conditional formatting on A1 with the following rule to change cell color as the value increases.

Conditional Formatting Color Scale Settings for Animation

Similarly, you can use the value in A1 to draw in-cell charts that grow as the value changes in A1.

Just let your imagination run wild.

Where can you use such animation?

Animation is a powerful attention grabber. I think you can use this type of animation in dashboards to display alerts. For eg. you can highlight portions of dashboard that changed when a different product (or month) is selected.

That said, I strongly recommend against overuse of animation effects. They can quickly become annoying. Not to mention, they are cumbersome to maintain (and add little value).

What are the limitations of Circular Reference based animation?

  • You must enable iterative mode of calculation.
  • This doesn’t work with charts. Excel charts do not pick up cell values unless the calculation is finished. So you cannot plug values in to charts to expect animated charts. If you are curious to build one, see Daniel’s animated business charts example.
  • This can slowdown your workbook: Whenever you run the animation, excel is going to do thousands of calculations and this will slowdown your workbook.

Download Excel Animation Workbook

I have put together a simple workbook showcasing several examples of this technique. Download and play with it.

Excel 2007 link | Excel 2003 link

(Make sure you have turned on the iterative mode.)

Do you find this technique interesting?

To be frank, I find this technique more amusing than useful. But I wrote about it anyway as it shows what is possible with excel. It can be useful in situations where there is too much information and you need to call users attention to something.

What about you? Do you see any practical applications for this technique? Share your ideas and opinions thru comments.

More Excel Magic

Your email address is safe with us. Our policies

Written by Chandoo
Tags: , , , , , , , , , , , ,
Home: Chandoo.org Main Page
? Doubt: Ask an Excel Question

37 Responses to “Excel Animation without Macros!”

  1. Vipul says:

    Chandoo this gives me idea/thought to improve on the motion charts w/o using macros. We at SuSapta had built one by using the auto refresh (of import data feature) provision. But this kind of use of circular reference seems to make it more flexible. I will share the file if I happen to spend some time for that sometime soon.

    Agree it is more from the point of view of amusement and joy of not using macros :)

  2. Squiggler says:

    Perhaps my system is a little fast!

    I loaded this in Excel 2010 and the changes are almost instant!

    and yes I checked the circular references!

  3. Chandoo says:

    @Squiggler… That happens for me too. Try changing the +1 portion of formula to +0.1. So, basically, you are increasing values by 0.1 instead of 1 at a time.

  4. Chandoo says:

    @Vipul… I would be interested to see what you come up with. Feel free to share an example.

  5. SUNIL KUMAR says:

    Dear Chandoo ji,

    I want to say thanks a lot for providing information related exl. Actually i need some function using by macro like sum, if, subtract and i have send you excel file on ur mail id , in which i can’t understood that how did make it. so plz give me details

    Thanks a lot

  6. Vipul says:

    Will surely share it. btw, the iterations may be off as default on some systems or set to some other limits, so if you want to make it always on and at certain limit, you may want to use the following code:
    Private Sub Workbook_Open()
    With Application
    .Iteration = True
    .MaxIterations = 32600
    .MaxChange = 0.0001
    End With
    Calculate
    End Sub
    Thanks to Mr. Excel for this code at http://www.mrexcel.com/archive/General/9085.html

  7. Pedro Wave says:

    @Squiggler, try this in P5 cell to slow your Excel 2010:
    =IF(N5="yes";IF(P5>=$O5;P5;P5+1
    +IF(REPT("A";32000)=REPT("A";32000);0;0))
    ;0)

    Change the speed by editing the number of repetitions.

  8. Pedro Wave says:

    My last formula with , separator:
    =IF(N5="yes",IF(P5>=$O5,P5,P5+1
    +IF(REPT("A",32000)=REPT("A",32000),0,0))
    ,0)

    In Spain we usually use ; argument separator because , is the decimal number separator.

  9. Felipe says:

    Awesome!

  10. Gregory says:

    I lost 30 minutes of my life playing around with this! :) Just kidding. A good trick to use with other co-workers who don’t have very much Excel savvy.

    The curious thing is that in Excel 2010 with Max iterations set to 32,767 and Max Change at 0.00000000001 the animation was almost instantaneous. It’s unbelievably fast.

  11. Alan Y says:

    Is the Icon set Arrow group Incorrect in the animation piece today? It appears that the direction should be = you create a direct default…….

  12. Alan Y says:

    The submit deleted some of my comment…..<=

  13. Alan Y says:

    Looked further..I think ALL icon sets are incorrect in terms of exhibiting all views (half moon, 1/4 etcx)

  14. Chandoo says:

    @Alan.. What do you mean by that?

    @Gregory: Is Excel 2010 so fast? I tried this with few other windows open (Firefox, file explorer, notepad++, 1 more excel file, an image editor and screen recording software etc.) and the speed varied between tests.

    @Felipe.. you are welcome :)

    @Sunil: Please post your questions to Excel forum – http://chandoo.org/forums/

  15. Gregory says:

    @Chandoo, lets put it this way, I couldn’t get Excel 2010 to slow down. I had several things open as well. Maybe my system is fast, but I don’t think overly so. Excel 2007 performed about as you would expect.

    You should try Excel 2010. You have it, right?

  16. Vipul says:

    Any thoughts around taking stuffs like this from Excel to PowerPoint?

  17. Tom says:

    Very cool. I can see the downside to using this, but nonetheless a good trick to have up my sleeve!

  18. Tom says:

    P.S. What are the drawbacks to enabling iterative calculation?

  19. NY says:

    this is awesome but excel 2010 doesn’t allow u to feel the slow movement – any help? Chandoo

  20. Alan Y says:

    why does any number entered with a “yes” generate only 1 Icon change versus 5? I enter 75, 250, 350, 4000, etc and get only one results. Should not the format elicit 5 options?

  21. Arman says:

    Hi Chandoo,

    How can i enable the iterative calculations in Excel2002. Thanks!

    Arman

  22. Raza says:

    I tried with CheckBox assigned to the same cell that require “yes” as input and changed the formula accordingly, also changed the font color to cell background color. It works well and become more simple just a “click” will do the job.

  23. Awsome says:

    This is awesome but i could not change the iterative calculation mode…how do I do it? Where in the formula section is it? Can you put this in a .ppt and would it work once you load the .ppt or do you have to manually put the “yes” for it to work? Also, I want to put 2 different graphs in one graph using excel. Does someone know how to do it?

  24. Sunil says:

    Amazing trick!

  25. uma says:

    Thanks a lot for offset function guidence

  26. brices11 says:

    Cool, but can’t figure out when I would want to use this. It did open my eyes to the changes in conditional formating between 2002 and 2007.

  27. Anil Patel says:

    Wow its great dude, i’ll try this today then after will write you what happens, queries, questions.

  28. ken says:

    Chandoo – — you are awesome. Thanks for posting all this great stuff on the web. This site has helped me immensely. (Also, it has made Excel more fun)

  29. Ricky says:

    Excellent… I like it!

  30. ROM says:

    Chandoo…How to make a similar effect for the decremental chart..let’s say from 100 to 50 ??

     

  31. Nima Iranian says:

    hi
    how we could flash/animate a cell if its value change?
    i have below code and its work singly but  i wanna make it dynamic;
    ””””””””””””””””””””””””””””””””””’
    Public RunWhen As Double

    Sub StartBlink1()
        With ThisWorkbook.Worksheets(“Sheet1″).Range(“A1″).Font
            If .ColorIndex = 10 Then
                .ColorIndex = 2
            Else
                .ColorIndex = 10
              End If
              ‘End If
        End With
        RunWhen = Now + TimeSerial(0, 0, 1)
        Application.OnTime RunWhen, “‘” & ThisWorkbook.Name & “‘!StartBlink1″, , True
    End Sub
     
     

  32. Maxim Manuel says:

    You are a genius. Congratulations!

  33. Rosli says:

    A lot of interesting info from you, Really appreciate!!

  34. Imran says:

    Can we use this make animated charts too ?

  35. Jimbo says:

    I can not get =IF(A2=”yes”,IF(A1>=100,A1,A1+1),0)

    To work all I get in A1 is #NAME?
    yes in A2 does nothing

    Any help would be great.

Leave a Reply