average with conditions

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
826
Office Version
  1. 365
Platform
  1. Windows
Hi

I’m trying to have a running average of the MPG but I don’t want to include any fill up that is 10 gallons or less

A:A is the date of the fill up
B:B is the amount of fuel in gallons used for the fill up
D:D is the millage driven for the fill up
F:F is the miles per galleon (MPG) for the fill up
G:G is the running average of MPG use since the beginning where i want to add the formula i'm having truoble with

It starts on A78 and right now it ends on A93 I don’t know what date it will end. I have the formula go down to A150 which I can extend it later
In F78, I have this formula that gives me MPG for that fill up and it’s copied down to F150
Excel Formula:
=IF(A78="","",+D78/B78)
In G78, I have this formula that gives me the running millage since the beginning and it runs down to G150
Excel Formula:
=IF(A78="","",AVERAGE($F$78:F78))
I’m trying to change it so if the amount of gallons used for the fill up (B:B) is less than 10.0, it won’t be used the average
I tried this but it puts a 0 in f and includes it in the average
Excel Formula:
=IF(AND(A78<>"",B78>10),AVERAGE($F$78:F78),””)

Or.
I need help with writing an if statement that will give me a running total but keep the cell blank if A is blank and not include a cell that's results is based on another cell that is equal or lower than 10




mike
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Does this do what you want?
2024-09-25.xlsx
ABCDEFG
1DateFuel (Gal)Miles/fillMPGRunning Avg MPG
7827-Jun-24252349.369.36
793-Jul-249869.56--
809-Jul-24302739.109.23
8115-Jul-24322939.169.21
8221-Jul-2455110.20--
8327-Jul-24201899.459.27
842-Aug-24121169.679.35
858-Aug-24131229.389.35
8614-Aug-24181649.119.32
8720-Aug-24302789.279.31
8826-Aug-248799.88--
891-Sep-249869.56--
907-Sep-247669.43--
9113-Sep-24191789.379.32
9219-Sep-24111019.189.30
9325-Sep-24171599.359.31
Sheet1
Cell Formulas
RangeFormula
F78:F93F78=D78/B78
G78G78=IF(B78<10,"",AVERAGEIF($B$78:$B78,">="&10,$F$78:$F78))
G79:G93G79=IF(B79<10,"--",AVERAGEIF($B$78:$B79,">="&10,$F$78:$F79))
 
Upvote 0
Solution
hi asbestos_Jen
thank you for the response. I'll try in when i get home
With your example, it looks like exactly what i want
I wanted to track my Average MPG and not include any thing below a 10 gallon fill up
I loan my truck out to neighbors and it throws the average off using it.
Am I missing something. why can't i just copy the G78 formula down the to end instead of writing it again in G79

mike

as you can see by my name...i'm still learning and this site is wonderful
 
Upvote 0
You can fill either one of them. I just used two different ways to show that the number wasn't being used in the average, either a blank cell or a double dash.
 
Upvote 0
I used the first one (formula) and copied it down to G150. I worked perfectly
thank you for your help

mike
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

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