Solved

Fiddly Excel count and average calculation

Posted on 2013-05-15
2
305 Views
Last Modified: 2013-05-15
I have list of data (32,000 rows deep) that looks like this:

4/1/2013 0:00      0
4/1/2013 0:01      6590
4/1/2013 0:02      0
4/1/2013 0:03      0
4/1/2013 0:04      0
4/1/2013 0:05      0
4/1/2013 0:06      0
4/1/2013 0:07      0
4/1/2013 0:08      0
4/1/2013 0:09      0
4/1/2013 0:10      0
4/1/2013 0:11      0
4/1/2013 0:12      0
4/1/2013 0:13      0
4/1/2013 0:14      0
4/1/2013 0:15      0
4/1/2013 0:16      0
4/1/2013 0:17      0
4/1/2013 0:18      0
4/1/2013 0:19      13350
4/1/2013 0:20      0
4/1/2013 0:21      0
4/1/2013 0:22      0
4/1/2013 0:23      0
4/1/2013 0:24      0
4/1/2013 0:25      0
4/1/2013 0:26      0
4/1/2013 0:27      0
4/1/2013 0:28      0
4/1/2013 0:29      0
4/1/2013 0:30      0
4/1/2013 0:31      0
4/1/2013 0:32      8640
4/1/2013 0:33      0
4/1/2013 0:34      0
4/1/2013 0:35      0
4/1/2013 0:36      0

Date & time with a flow. The Flow is usually zero.

I need to count the zeros from the first zero up to and including the next non-zero number, then divide the non-zero number and populate the adjacent column with the average flow number since the last non-zero. i.e. there are 18 zeros until 13350, 13 zeros until 8640, Like this:

4/1/2013 0:00      0      
4/1/2013 0:01      6590      
4/1/2013 0:02      0      741.6666667
4/1/2013 0:03      0      741.6666667
4/1/2013 0:04      0      741.6666667
4/1/2013 0:05      0      741.6666667
4/1/2013 0:06      0      741.6666667
4/1/2013 0:07      0      741.6666667
4/1/2013 0:08      0      741.6666667
4/1/2013 0:09      0      741.6666667
4/1/2013 0:10      0      741.6666667
4/1/2013 0:11      0      741.6666667
4/1/2013 0:12      0      741.6666667
4/1/2013 0:13      0      741.6666667
4/1/2013 0:14      0      741.6666667
4/1/2013 0:15      0      741.6666667
4/1/2013 0:16      0      741.6666667
4/1/2013 0:17      0      741.6666667
4/1/2013 0:18      0      741.6666667
4/1/2013 0:19      13350      741.6666667
4/1/2013 0:20      0      664.6153846
4/1/2013 0:21      0      664.6153846
4/1/2013 0:22      0      664.6153846
4/1/2013 0:23      0      664.6153846
4/1/2013 0:24      0      664.6153846
4/1/2013 0:25      0      664.6153846
4/1/2013 0:26      0      664.6153846
4/1/2013 0:27      0      664.6153846
4/1/2013 0:28      0      664.6153846
4/1/2013 0:29      0      664.6153846
4/1/2013 0:30      0      664.6153846
4/1/2013 0:31      0      664.6153846
4/1/2013 0:32      8640      664.6153846
4/1/2013 0:33      0      
4/1/2013 0:34      0      
4/1/2013 0:35      0      
4/1/2013 0:36      0
0
Comment
Question by:hgj1357
2 Comments
 
LVL 50

Accepted Solution

by:
barry houdini earned 500 total points
Comment Utility
Assuming data in columns A and B try this formula in C3 copied down

=IFERROR(IF(B2>0,INDEX(B3:B$33000,MATCH(TRUE,INDEX(B3:B$33000>0,0),0))/MATCH(TRUE,INDEX(B3:B$33000>0,0),0),C2),"")

see attached

regards, barry
average-across-rows.xlsx
0
 
LVL 2

Author Closing Comment

by:hgj1357
Comment Utility
Bob's your uncle!  Works like a charm
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
Outlook Free & Paid Tools
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now