Solved

Fiddly Excel count and average calculation

Posted on 2013-05-15
2
307 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
ID: 39169733
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
ID: 39169843
Bob's your uncle!  Works like a charm
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

813 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

18 Experts available now in Live!

Get 1:1 Help Now