How to Multiply Matrix in Excel

5/4 Edited to

... Read moreOkay, so let's talk about something that used to give me major headaches in Excel: matrix multiplication. If you've ever dealt with linear algebra, statistics, or even just complex data transformations, you know how crucial it is. For the longest time, I was trying to figure out the right 'matrix product formula' to use, and let me tell you, doing it manually is a nightmare! But then I stumbled upon Excel's super powerful MMULT function, and it completely changed my workflow. I want to share my personal journey and tips on how to multiply matrices in Excel effortlessly. First off, the magic happens with the MMULT function. It's designed specifically for this task. The syntax is pretty straightforward: =MMULT(array1, array2). Sounds simple, right? But there are a couple of crucial things to remember, which I learned the hard way. For MMULT to work, the number of columns in your first matrix (let's call it array1) must be equal to the number of rows in your second matrix (array2). If they don't match, you'll end up with a dreaded #VALUE! error, and trust me, that can be frustrating! Let me walk you through my step-by-step process, which I find super easy to follow. Imagine you have two matrices, say, one in B38:C41 (which is a 4R x 2C matrix, meaning 4 rows and 2 columns) and another in E38:F39 (a 2R x 2C matrix). You want to find their product, A*B. Determine the Output Size: Before you even type a formula, figure out the size of your resulting matrix. If you're multiplying a 4R x 2C matrix by a 2R x 2C matrix, your result will be a 4R x 2C matrix. This is a critical step! Select the Result Range: Now, here's my pro tip: *select the entire range where you want your answer to appear first*. So, if your result will be 4R x 2C, select a 4x2 block of empty cells. Enter the MMULT Formula: With your result range still selected, type in your formula. For our example, it would look like this: =MMULT(B38:C41, E38:F39). Confirm as an Array Formula: This is the final, crucial step, especially for older versions of Excel. Instead of just pressing Enter, you need to press Ctrl + Shift + Enter. This tells Excel it's an array formula, and it will automatically add curly braces {} around your formula in the formula bar. For newer versions of Excel, you might just press Enter, and it will spill the results, but the Ctrl+Shift+Enter habit is good to keep. I remember the first time I got it right, seeing the A*B result appear instantly was such a relief! This technique is incredibly useful for all sorts of calculations, from rotating points in geometry to solving systems of equations in data science. You can find MMULT under the 'Formulas' tab, in 'Math & Trig Functions' if you prefer navigating the ribbon. Just make sure your array1 and array2 inputs are valid numerical arrays, and you're good to go. It truly makes complex 'matrix mul' tasks feel simple!