Sum Totals for a Range of Cells Based on What Is Listed in Two Columns

jomilo

New Member
Joined
Mar 10, 2011
Messages
16
Hello, Excel Gurus!

I need a formula that can add the total fuel costs for specific vehicles listed in a range of cells based upon what is in two columns, i.e., 'Add the fuel costs together for vehicle ABC DEF if the amounts in cells E5 to E9 are greater than 0 AND the vehicle ID is "ABC DEF". I'd need to have a formula for each vehicle I'd want to track, but in the instances referenced in the image below, the results would be:


  • Vehicle "ABC DEF" = $400.00 (total fuel cost for the month)
  • Vehicle "123 456" = $450.00 (total fuel cost for the month)

I tried combining the SUMIFS formula with the use of AND, but my results would always end up being either "True" or "False" instead of the sum of fuel costs for each particular vehicle over the course of the month. I think I'd need to use an array formula to account for the range of cells. But the bottom line is that I need to be able to compare each row to determine if the Amount is greater than 0 and the Vehicle ID is included. If those two conditions are true, then I'd need to add the fuel cost for that specific vehicle. This evaluation would need to be applied to each row of the spreadsheet so that at the end of my report I can use the formula to display how much total money for the month was spent on fuel for each of the respective vehicles. I hope I've explained it well enough. If not, let me know.

I thank you for any help you can provide. It is greatly appreciated.

 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Wow! Thanks, Aladin. I made it so much more complicated than it needed to be. Thank you for the quick, clear response.
 
Upvote 0

Forum statistics

Threads
1,215,336
Messages
6,124,329
Members
449,155
Latest member
ravioli44

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