Need Flexible Average based on Year

dwgnome

Active Member
Joined
Dec 18, 2005
Messages
441
Hi,

I am in need of modifying the existing average formula in H6 to allow user input as shown. That is user picks number of years to average and the starting year along with which equipment. I would like to keep the SUMIF/COUNTIF construct to avoid all errors if possible.


Baseline Comps


<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 11pt; FONT-FAMILY: Calibri,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><COLGROUP><COL style="FONT-WEIGHT: bold; WIDTH: 30px"><COL style="WIDTH: 122px"><COL style="WIDTH: 96px"><COL style="WIDTH: 89px"><COL style="WIDTH: 97px"><COL style="WIDTH: 102px"><COL style="WIDTH: 97px"><COL style="WIDTH: 97px"></COLGROUP><TBODY><TR style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><TD></TD><TD>B</TD><TD>C</TD><TD>D</TD><TD>E</TD><TD>F</TD><TD>G</TD><TD>H</TD></TR><TR style="HEIGHT: 16px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">3</TD><TD></TD><TD style="BACKGROUND-COLOR: #ffcc99; TEXT-ALIGN: right">3</TD><TD>Choose # of consecutive years</TD><TD></TD><TD></TD><TD></TD><TD></TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">4</TD><TD></TD><TD></TD><TD></TD><TD></TD><TD></TD><TD></TD><TD></TD></TR><TR style="HEIGHT: 19px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">5</TD><TD style="FONT-SIZE: 10pt"></TD><TD style="BACKGROUND-COLOR: #ff99cc; TEXT-ALIGN: right">2009</TD><TD>Choose Start Year</TD><TD></TD><TD></TD><TD></TD><TD></TD></TR><TR style="HEIGHT: 24px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">6</TD><TD style="FONT-SIZE: 14pt; FONT-STYLE: italic">Baseline by Year</TD><TD></TD><TD></TD><TD></TD><TD style="BACKGROUND-COLOR: #ffff99; TEXT-ALIGN: center">Distrib</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ffffcc">3-yr avg:</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ffffcc; TEXT-ALIGN: center">2.7</TD></TR><TR style="HEIGHT: 19px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">7</TD><TD style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; BACKGROUND-COLOR: #ccccff"></TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff">Market-Share</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff"></TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff"></TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff"></TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff"></TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff"></TD></TR><TR style="HEIGHT: 24px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">8</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff">Equipment</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccffcc; TEXT-ALIGN: center">2006</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff; TEXT-ALIGN: center">2007</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff; TEXT-ALIGN: center">2008</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff; TEXT-ALIGN: center">2009</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff; TEXT-ALIGN: center">2010</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccccff; TEXT-ALIGN: center">2011</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">9</TD><TD style="TEXT-ALIGN: left">Store1</TD><TD style="TEXT-ALIGN: center">0.69</TD><TD style="TEXT-ALIGN: center">1.78</TD><TD style="TEXT-ALIGN: center">2.86</TD><TD style="TEXT-ALIGN: center">1.93</TD><TD style="TEXT-ALIGN: center">0.85</TD><TD style="TEXT-ALIGN: center">0.46</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">10</TD><TD style="TEXT-ALIGN: left">Store2</TD><TD style="TEXT-ALIGN: center">22.8</TD><TD style="TEXT-ALIGN: center">33.3</TD><TD style="TEXT-ALIGN: center">27.9</TD><TD style="TEXT-ALIGN: center">29.0</TD><TD style="TEXT-ALIGN: center">31.2</TD><TD style="TEXT-ALIGN: center">27.4</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">11</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: left">Store subtotals</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">23.5</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">35.1</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">30.8</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">31.0</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">32.0</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: center">27.8</TD></TR><TR style="HEIGHT: 19px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">12</TD><TD style="TEXT-ALIGN: left">Distrib</TD><TD style="TEXT-ALIGN: center">2.81</TD><TD style="TEXT-ALIGN: center">0.296</TD><TD style="TEXT-ALIGN: center">1.4</TD><TD style="TEXT-ALIGN: center">3.4</TD><TD>#DIV/0!</TD><TD style="TEXT-ALIGN: center">2.00</TD></TR><TR style="HEIGHT: 20px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">13</TD><TD style="FONT-WEIGHT: bold; TEXT-ALIGN: right">Total</TD><TD style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; TEXT-ALIGN: center">26.3</TD><TD style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; TEXT-ALIGN: center">35.4</TD><TD style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; TEXT-ALIGN: center">32.2</TD><TD style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; TEXT-ALIGN: center">32.6</TD><TD style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; TEXT-ALIGN: center">33.1</TD><TD style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; TEXT-ALIGN: center">28.5</TD></TR></TBODY></TABLE>


<TABLE style="FONT-SIZE: 10pt; BORDER-LEFT-COLOR: #00ff00; BORDER-BOTTOM-COLOR: #00ff00; COLOR: #000000; BORDER-TOP-STYLE: groove; BORDER-TOP-COLOR: #00ff00; FONT-FAMILY: Arial; BORDER-RIGHT-STYLE: groove; BORDER-LEFT-STYLE: groove; BACKGROUND-COLOR: #fffcf9; BORDER-RIGHT-COLOR: #00ff00; BORDER-BOTTOM-STYLE: groove"><TBODY><TR><TD>Spreadsheet Formulas</TD></TR><TR><TD><TABLE style="FONT-SIZE: 9pt; FONT-FAMILY: Arial" cellSpacing=0 cellPadding=2 border=1><TBODY><TR style="FONT-SIZE: 10pt; BACKGROUND-COLOR: #cacaca"><TD>Cell</TD><TD>Formula</TD></TR><TR><TD>H6</TD><TD>=IF(ISERROR(SUMIF(F12:H12,">0")/COUNTIF(F12:H12,">0")),"",SUMIF(F12:H12,">0")/COUNTIF(F12:H12,">0"))</TD></TR><TR><TD>C11</TD><TD>=SUMIF(C9:C10,"<10E37")</TD></TR><TR><TD>D11</TD><TD>=SUMIF(D9:D10,"<10E37")</TD></TR><TR><TD>C13</TD><TD>=SUMIF(C9:C12,"<10E37")-C11</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>


Excel tables to the web >> http://www.excel-jeanie-html.de/index.php?f=1" target="_blank"> Excel Jeanie HTML 4

Excel 2003, Win XP

Thank you.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,216,759
Messages
6,132,558
Members
449,735
Latest member
Gary_M

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