Sum Rows in Lookup

MargaretS

New Member
Joined
Nov 12, 2018
Messages
4
My first post. I have two tabs, Assets and Fuel. On the Asset tab I want to total the miles for my three vehicles, Jeep 1, Jeep 2 and Car 1. There are multiple columns on both tabs in addition to the ones I listed; I included only the bare necessities in this example.

I have tried vlookup and sumif. I am able to pull the first row that matches (i.e. Jeep 1 returns 42 rather than 117 for miles). No matter what I do, I can't get 117 for the answer, let alone the correct figure for Jeep 2 and Car 1.

Running Excel 2016.

Thank you!

[TABLE="width: 500"]
<tbody>[TR]
[TD]Table 1-Asset[/TD]
[TD][/TD]
[TD][/TD]
[TD]Table 2-Fuel[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Vehicle[/TD]
[TD]Miles[/TD]
[TD][/TD]
[TD]Vehicle[/TD]
[TD]Miles[/TD]
[TD]Cost[/TD]
[/TR]
[TR]
[TD]Jeep 1[/TD]
[TD][/TD]
[TD][/TD]
[TD]Jeep 1[/TD]
[TD]42[/TD]
[TD]17.45[/TD]
[/TR]
[TR]
[TD]Jeep 2[/TD]
[TD][/TD]
[TD][/TD]
[TD]Car 1[/TD]
[TD]10[/TD]
[TD]12.01[/TD]
[/TR]
[TR]
[TD]Car 1[/TD]
[TD][/TD]
[TD][/TD]
[TD]Jeep 1[/TD]
[TD]75[/TD]
[TD]25.00[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Jeep 2[/TD]
[TD]65[/TD]
[TD]14.95[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Car 1[/TD]
[TD]14[/TD]
[TD]12.70[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Jeep 2[/TD]
[TD]64[/TD]
[TD]42.64[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Car 1[/TD]
[TD]49[/TD]
[TD]32.75[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Car 1[/TD]
[TD]13[/TD]
[TD]6.42[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
SUMPRODUCT will do as you require

I made two sheets, named Asset and Fuel

Then added the headings Veh & Miles in Asset sheet
Then added the headings Veh, Miles and cost in fuel sheet

On the asset sheet in cell B2 I entered the above formula and just dragged it down.

It only works for the sample data you provided but you could edit it to ay size array or location

Coops

Code:
=SUMPRODUCT((Fuel!$A$2:$A$9=Asset!A2)*Fuel!$B$2:$B$9)
 
Upvote 0
Why not just Insert a PivotTable ??

Excel 2007
HIJK
1
2Values
3Row LabelsSum of MilesSum of Cost
4Car 18663.88
5Jeep 111742.45
6Jeep 212957.59
7Grand Total332163.92
8
9
10
Sheet1
 
Last edited:
Upvote 0
SUMPRODUCT will do as you require

I made two sheets, named Asset and Fuel

Then added the headings Veh & Miles in Asset sheet
Then added the headings Veh, Miles and cost in fuel sheet

On the asset sheet in cell B2 I entered the above formula and just dragged it down.

It only works for the sample data you provided but you could edit it to ay size array or location

Coops

Code:
=SUMPRODUCT((Fuel!$A$2:$A$9=Asset!A2)*Fuel!$B$2:$B$9)


That did the trick. Thank you.
 
Upvote 0
Hi Michael - I didn't want a pivot table in this worksheet, just pulling data from another tab. I wanted the summed miles by vehicle included so I could produce a pivot after further analysis.

Thank you for your assistance.
 
Upvote 0
No problem, I'll keep subscribed for a while incase there are any issues.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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