Need help with shortening formula, with multiple tables as inputs

mrblister

Board Regular
Joined
Nov 20, 2016
Messages
191
Office Version
  1. 2019
Platform
  1. Windows
ABCDEF
1MATERIALS REQUIRED PER EACH VEHICLE
2VehicleNutsBoltsPlasticSheetsMetalSheets
3Bike10025010
4Car1000021
5Bus2000500050
6Transport40006000650
7Plane100002050020500
8
9
10MANUFACTURING OUTPUT
11BikeCarBusTransportPlane
12Day 100000
13Day 222000
14Day 301013
15
16
17MATERIALS USED PER DAY
18NutsBoltsPlasticSheetsMetalSheets
19Day 10000
20Day 22200xxx
21Day 3xxxx

<tbody>
</tbody>

I have 3 tables, on 3 different sheets in my workbook (I put them all in the table above for simplicity).

I need help shortening my formula (For Materials Used Per Day).
In cell B20 (Nuts used on Day 2), I currently have: =(B13*VLOOKUP(B11,A2:E7,MATCH(B18,A2:E2,0),0))+(C13*VLOOKUP(C11,A2:E7,MATCH(B18,A2:E2,0),0))+(D13*VLOOKUP(D11,A2:E7,MATCH(B18,A2:E2,0),0))+(E13*VLOOKUP(E11,A2:E7,MATCH(B18,A2:E2,0),0))+(F13*VLOOKUP(F11,A2:E7,MATCH(B18,A2:E2,0),0))

But my tables are much bigger than my example above! I need to condense my formula.

I would appreciate suggestions for a shorter formula. Thanks in advance!
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Given the tables defined as above:

B20: =MMULT($B13:$F13,B$3:B$7)

which is about as simple as you can get! :) Drag down and across as needed.

This relies on the rows of the first table being the same as the columns of the second table. It also relies on the days in the third table being in exactly the same order as the second table, and the columns of the first table being the same as the columns of the third table. But depending on the actual layout of your sheets, we can still probably make it work using OFFSET and MATCH to get the right ranges.
 
Last edited:
Upvote 0
Given the tables defined as above:

B20: =MMULT($B13:$F13,B$3:B$7)

which is about as simple as you can get! :) Drag down and across as needed.

This relies on the rows of the first table being the same as the columns of the second table. It also relies on the days in the third table being in exactly the same order as the second table, and the columns of the first table being the same as the columns of the third table. But depending on the actual layout of your sheets, we can still probably make it work using OFFSET and MATCH to get the right ranges.

Thanks Eric! Didn't know about that function. So... simple and clean! It seems to work, and luckily my rows do match my columns. But it fails if a cell has no entry. I put in zeros into the blank cells and it works, but my tables are huge and I don't want to insert zeros every time there isn't a value. Is it possible to get this to work with blank cells (interpreted as zero)?
 
Upvote 0
Thanks Eric! Didn't know about that function. So... simple and clean! It seems to work, and luckily my rows do match my columns. But it fails if a cell has no entry. I put in zeros into the blank cells and it works, but my tables are huge and I don't want to insert zeros every time there isn't a value. Is it possible to get this to work with blank cells (interpreted as zero)?

Oh wait, I found a solution: B20: =MMULT($B13:$F13+0,B$3:B$7+0)

Not my solution. I just figured someone else must've had the same issue so I looked it up.
 
Upvote 0
Glad you got it working! The MMULT (Matrix multiplication) is a little obscure, and many people who forgot their algebra wouldn't think to use it anyway. But every once in a while, it's exactly the right tool for the problem. Good job finding the +0 fix.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,694
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top