#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 63
Default Sum on a count of 45

I have information that looks like this.

Name1 Name2 Name3
Wed 11/01 N 0 1
Thu 11/02 N 1 0


It has the name going across and the date down the side. You can ignore the
N that is a seperate column that is used. What I need to do is for a given
date lets say 5/1, I need to count back 45 0's or 1's, and sum that amount.
The problem is not everyone has a count for that day. Any suggestions or how
I can find out what date I have to go back to find a count of 45 so I can sum
off of that date?

Thanks
Vick
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 213
Default Sum on a count of 45

I have information that looks like this.

Name1 Name2 Name3
Wed 11/01 N 0 1
Thu 11/02 N 1 0


It has the name going across and the date down the side. You can
ignore the N that is a seperate column that is used. What I need to
do is for a given date lets say 5/1, I need to count back 45 0's or
1's, and sum that amount. The problem is not everyone has a count for
that day. Any suggestions or how I can find out what date I have to go
back to find a count of 45 so I can sum off of that date?


Can't think of a clever way to do the calculation, but here's a brute-
force way with three "helper" columns.

Suppose C2 is the top cell in the list of 0's or 1's, with some empty
cells interspersed. Starting with columns D, E, and F all blank, put
these formulas in:

D2: =IF(C2="","",C2)

D3: =RIGHT(D2&C3,45)
and copy down far as many rows as needed

E2: =C2

E3: =E2+N(C3)-IF(LEN(D2)=45,LEN(C3)*VALUE(LEFT(D2,1)))
and copy down far as many rows as needed

F2: =IF(LEN(D2)=45,E2,"")
and copy down far as many rows as needed

Repeat this for each "Name" column. You can hide the helper columns or
use different sheets for them. Doubtless, there's a way to use fewer
columns, but I tried to keep it easy to understand.

Explanation:

Column D is a string that tracks the most recent 45 non-empty 0/1 values.
Newer ones enter on the right and older ones exit on the left.

Column E keeps a running sum, adding each value that enters and
subtracting each value that exits.

Column F echoes column E but starts when there are 45 values to count.

If there might be spurious characters in the cells, some extra cleanup in
the formulas might be needed; for example,
=LEFT(TRIM(C3))
instead of just C3.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count Employee Work Time - Don't Double-count Overlapping Apts. J Excel Worksheet Functions 0 April 27th 07 05:52 AM
Excel 2000, count, sort a list & count totals? sunslight Excel Worksheet Functions 1 April 9th 07 05:46 PM
Count Intervals of 2 Consecutive Values in same Row and Return Count across Row Sam via OfficeKB.com Excel Worksheet Functions 6 November 29th 05 03:27 PM
Count Intervals of 2 Numeric values in same Row and Return Count across Row Sam via OfficeKB.com Excel Worksheet Functions 12 September 24th 05 10:58 PM
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Excel Worksheet Functions 9 July 31st 05 03:37 AM


All times are GMT +1. The time now is 05:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"