Skip to main content
Skip to main content
Microsoft 365

Excel Fun—Build 3D graphics from a spreadsheet

Today’s post was written by Carl Kadie, Ph.D., a research developer in Microsoft Research.

How Excel helps to understand 3D graphics

From video games to movie special effects, 3D graphics drives today’s entertainment. But how do 3D graphics work? How does the computer know where on the screen to put the little dots of color? Motivated by simple curiosity, I wanted to understand this. And for me, to understand means to make an Excel spreadsheet. This article should interest you, too, if you are curious about 3D graphics. It also serves as an example of how Excel can make something as complex as 3D graphics as simple as a few worksheet cells connected by multiplication and addition.

In the end, I didn’t replicate Halo, but I did get lovely cube that I can control by changing a few numbers in Excel. For example, one cell tells how many degrees to rotate the cube. When I change the value in that cell from 20 degrees (figure on left) to 5 degrees (figure on right), the cube changes:

Fun with Excel 1Fun with Excel 2

You can try it, too. In the embedded spreadsheet below, change the value in yellow, press Enter and to see how the figure changes. Alternatively, download the spreadsheet and play with it in Excel by changing the values in yellow.

 The key to the puzzle—rotate a square

Inspired by Einstein’s quote, “Everything should be made as simple as possible, but not simpler,” I set a goal to create and rotate a 2D square. But how in Excel do you even draw a square (let alone rotate it)? We don’t typically think of Excel as a drawing program. Its XY (scatter) chart, however, you can take a list of points (each with an x- and y-coordinate) and connect the dots. So, I listed a square’s center point and its four corners (figure on left): and Excel gave me this (figure on right):

Fun with Excel 3Fun with Excel 4

Now that I had my square, I needed to figure out how to rotate it. Happily, a Wikipedia article told me exactly what to do. Sadly, the article is written in the language of matrix mathematics, so I had to convert the instructions into a 2 x 2 table and then apply the multiplication and addition. Here is what I did:

Created a place to input the number of degrees we want the square to rotate. In the spreadsheet, this is cell C43 and I highlighted it in yellow and gave it value of 10.

Fun with Excel 5Next, I created a 2 x 2 “rotation matrix” with formulas, from the Wikipedia article, which used only cell C43.

Fun with Excel 6

Given an input of 10 degrees, the formulas result in these numbers:

Fun with Excel 7The first row says that to create a new x-coordinate for a point, take .985 of its old x-coordinate and .174 of its old y-coordinate. Similarly, the second row says that to create a new y-coordinate for a point we take -.174 time its old x-coordinate plus .985 of its old y-coordinate.

Doing this multiplication and addition for each of the points resulted in a second table of points. (Notice the first point was <0,0> before and is <0,0> after. I discovered, unsurprisingly, that rotating something at the center of the universe doesn’t change its position.) When I plotted the new table of points, I saw my rotation!

Fun with Excel 8Fun with Excel 9

Changing the input from 10 degrees to –20 degrees, shifted the cube:

Fun with Excel 10

Again, you can try this in following embedded spreadsheet. Simply, change the value in yellow, press Enter and see how the figure changes.

After I got 2D rotation working, the rest followed the same pattern and fell into place. When you open the spreadsheet, you’ll see the 2D rotation, then the 2D translation and finally 2D scaling. Tabbing to the second worksheet, you’ll find the 3D cube, which starts with a cube (defined with one center point and 16 corner points), three rotations (because in 3D there are three ways to rotate), translation, scaling and then a couple of ways to do perspective.

Beyond graphic rotation

This spreadsheet confirmed for me that Excel is a great tool for understanding. Humankind took two thousand years to grasp exactly how to represent our 3D world in 2D. I’m amazed that much of that knowledge can be captured in this relatively simple spreadsheet.

In my professional work—from recommending TV shows, classifying junk email and designing HIV vaccines—my collaborators and I often prototype our ideas in Excel. By making every value visible and explorable, we avoid problems and discover shortcuts. It’s also often how we communicate person-to-person and it’s how we communicate with “our future selves” by giving us something to go back to and test against.

So, if you want to understand something, make an Excel spreadsheet!

—Carl Kadie

You may also like these articles

Image for: View live transcripts in Microsoft Teams meetings, track Excel changes, and increase hybrid work security—here’s what’s new to Microsoft 365
• 5 min read

View live transcripts in Microsoft Teams meetings, track Excel changes, and increase hybrid work security—here’s what’s new to Microsoft 365

This month, we're announcing some top requested features like tracking changes in Excel and live transcriptions in Teams, as well as some soon-to-be-favorites like meeting recaps, turning Word documents in presentations, and more.

Image for: Family hanging out at home baking holiday cookies using Lenovo Ideapad Flex 3 to make holiday cards
• 5 min read

New apps and features in Microsoft 365 for individuals and families this fall

Since we introduced Microsoft 365 to individuals and families earlier this year, we have continued to deliver new innovations across our apps and services to help you and your family save time and stay connected. See what’s new below. Locate your loved ones and build better driving habits with Microsoft Family Safety Stay connected even…

Image for: A man is using his Lenovo laptop like a tablet while sitting in a comfortable chair in a Modern office setting
• 6 min read

Microsoft Productivity Score and personalized experiences—here’s what’s new to Microsoft 365 in October

As I reflect on an action-packed few weeks, I’m struck by how much work has evolved in these past months. And I know our customers feel it too. After quickly moving to remote and hybrid work models this spring, organizations are now seeking sustainable ways to help people collaborate, be productive, and prioritize their wellbeing…