# Formula help please (If, And, Count?)

#### TiNC701

##### New Member
Hi, I have been trying to create a formula for R9 of the attached. I require it to add the cells in R8 (positive & Negative) but only upto and including that month, ignoring ones with "No data" then count how many columns had deliveries R6 again only upto and including that month. Then divide the sum of R8 by number of months with deliveries. For example
K9 will =(C8+D8+E8+F8+G8+H8+I8+J8)/7
But E9 = (C8+D8+E8)/3
If no deliveries then say "No data" like A9
I hope this makes sense, I have tried so many variations and just cannot get this to automate

### Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

#### Fluff

##### MrExcel MVP, Moderator
Excel Formula:
``=IFERROR(AVERAGEIF(\$B8:C8,"<>No data"),"No Data")``

#### TiNC701

##### New Member
Thank you, unfortunately it doesn't quite work. When it gets to Column J it is dividing by 8 rather than the 7 months where deliveries were actually received. I need it to not count a cell in R6 if it is zero

#### TiNC701

##### New Member
Excel Formula:
``=IFERROR(AVERAGEIF(\$B8:C8,"<>No data"),"No Data")``

#### Fluff

##### MrExcel MVP, Moderator

Excel Formula:
``=SUM(\$B8:C8)/(COUNTIFS(\$B6:C6,">0"))``

#### TiNC701

##### New Member
Sorry isn't this the same as your first suggestion?
Excel Formula:
``=SUM(\$B8:C8)/(COUNTIFS(\$B6:C6,">0"))``
That calculation works better thank you. Can it be combined with the IFError so if I have the first 3 months with No Data it says "No data"? I tried this IFERROR(SUM(\$B8:C8,"<>NO data")/(COUNTIFS(\$B6:C6,">0")),"No data) but that doesn't seem to work, as soon as I get to the first month with data it still inserts "No data"

#### Fluff

##### MrExcel MVP, Moderator

Just wrap my formula in an iferror.

#### TiNC701

##### New Member
Perfect thank you so much for your help

#### Fluff

##### MrExcel MVP, Moderator
You're welcome & thanks for the feedback.

Replies
2
Views
51
Replies
0
Views
238
Replies
17
Views
184
Replies
6
Views
546
Replies
2
Views
171

1,130,146
Messages
5,640,392
Members
417,140
Latest member
whiteprose

### 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.

### Which adblocker are you using?

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

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