JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,676
- Office Version
- 365
- Platform
- Windows
As part of my moving sums and averages project described here:
I also need to calculate a moving count of cells containing numbers. My first try was with CountIfs, but I discovered here that CountIfs cannot be used with IsNumber and to use SumProduct:
I tried using SumProduct, as shown in the Count column in the minisheet below, but it isn't working. I can get what I want with two columns, IsNumber and Countx, but would prefer a single column. Is there a formula for the Count column that will get the result in the Countx column without needing the IsNumber column?
Is Take() the best way to calculate a moving sum?
About a week ago, Cubist introduced me to the Take function. I have made great use of it. I just had a situation where I needed to calculate a moving average. The Take function seems like the perfect solution, but I would appreciate any comments. Here are several examples. The mini-sheet is...
www.mrexcel.com
I also need to calculate a moving count of cells containing numbers. My first try was with CountIfs, but I discovered here that CountIfs cannot be used with IsNumber and to use SumProduct:
Countifs & Isnumber combo
Hello, I am trying to use ISNUMBER in a countifs formula and it's not working so appreciate if someone can help me out. It doesn't return an error but it's not counting the numeric values in column AM. I had this formula...
www.mrexcel.com
I tried using SumProduct, as shown in the Count column in the minisheet below, but it isn't working. I can get what I want with two columns, IsNumber and Countx, but would prefer a single column. Is there a formula for the Count column that will get the result in the Countx column without needing the IsNumber column?
Moving Totals.xlsx | |||||||
---|---|---|---|---|---|---|---|
B | C | D | E | F | |||
2 | 5 | Number of rows | |||||
3 | |||||||
4 | # | Value | IsNumber | Countx | Count | ||
5 | 1 | 5 | 1 | 1 | 0 | ||
6 | 2 | 8 | 1 | 2 | 0 | ||
7 | 3 | 0 | 2 | 0 | |||
8 | 4 | 2 | 1 | 3 | 0 | ||
9 | 5 | 6 | 1 | 4 | 0 | ||
10 | 6 | 0 | 3 | 0 | |||
11 | 7 | 9 | 1 | 3 | 0 | ||
12 | 8 | 3 | 1 | 4 | 0 | ||
13 | 9 | 0 | 3 | 0 | |||
14 | 10 | 4 | 1 | 3 | 0 | ||
Sheet2 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
D5:D14 | D5 | =ISNUMBER([@Value])+0 |
E5:E14 | E5 | =SUM(TAKE(Table2[[#Headers],[IsNumber]]:[@IsNumber],-NumRows)) |
F5:F14 | F5 | =SUMPRODUCT(ISNUMBER(TAKE(Table2[[#Headers],[Value]]:[@Value],-NumRows))) |
B5:B14 | B5 | =ROW([@['#]])-ROW(Table2[[#Headers],['#]]) |
Named Ranges | ||
---|---|---|
Name | Refers To | Cells |
NumRows | =Sheet2!$C$2 | E5:F14 |