ibmy
Board Regular
- Joined
- Mar 4, 2020
- Messages
- 134
- Office Version
- 2016
- Platform
- Windows
Hi,
Explanation:
Let say Current Value Column D = B , Previous Value Column D = b ... Current Value Column C = A , Previous Value Column C = a
When there is a value in Column F ( F2<>"" / F2>0 ), count how many set ranges in Column C&D meet condition of both : a>=A AND b<=B . Stop count when one of it does not meet condition.
Example Row 3 : There is value in F3, so count how many set ranges meet condition a>=A AND b<=B , there is none, 0.
Example Row 29 : There is value in F29, there are 11 set ranges meet condition from row 28 to row 18 (Column C&D), stop at row 17 because 1.21514 (a) < 1.21517 (A)
Problem a bit similar to post Assign "1" but the difference are:
1. This post is about Count while previous post is about Assign.
2. This post is focus on previous cell/above row when there is value in Column F while previous post is assign from F2 to last row.
1.11.xlsb | |||||||
---|---|---|---|---|---|---|---|
C | D | E | F | G | |||
1 | Var A | Var B | expected result : | ||||
2 | 1.21527 | 1.21497 | |||||
3 | 1.21532 | 1.21499 | 4 | 0 | |||
4 | 1.21533 | 1.21499 | |||||
5 | 1.21540 | 1.21499 | |||||
6 | 1.21540 | 1.21491 | |||||
7 | 1.21540 | 1.21498 | |||||
8 | 1.21500 | 1.21492 | |||||
9 | 1.21508 | 1.21503 | |||||
10 | 1.21507 | 1.21498 | |||||
11 | 1.21507 | 1.21503 | 2 | 2 | |||
12 | 1.21509 | 1.21503 | |||||
13 | 1.21511 | 1.21503 | |||||
14 | 1.21514 | 1.21506 | |||||
15 | 1.21515 | 1.21509 | 1 | 0 | |||
16 | 1.21517 | 1.21509 | |||||
17 | 1.21514 | 1.21509 | 1 | 3 | |||
18 | 1.21517 | 1.21509 | |||||
19 | 1.21517 | 1.21514 | 6 | 1 | |||
20 | 1.21518 | 1.21514 | |||||
21 | 1.21519 | 1.21514 | |||||
22 | 1.21517 | 1.21514 | |||||
23 | 1.21519 | 1.21514 | |||||
24 | 1.21517 | 1.21514 | |||||
25 | 1.21519 | 1.21514 | |||||
26 | 1.21519 | 1.21515 | 2 | 1 | |||
27 | 1.21521 | 1.21514 | |||||
28 | 1.21519 | 1.21514 | |||||
29 | 1.21517 | 1.21515 | 4 | 11 | |||
30 | 1.21519 | 1.21514 | |||||
31 | 1.21521 | 1.21514 | |||||
32 | 1.21522 | 1.21514 | |||||
33 | 1.21525 | 1.21514 | |||||
34 | 1.21528 | 1.21524 | |||||
35 | 1.21539 | 1.21531 | |||||
36 | 1.21538 | 1.21530 | |||||
37 | 1.21535 | 1.21530 | 9 | 1 | |||
38 | 1.21538 | 1.21529 | |||||
39 | 1.21538 | 1.21520 | |||||
40 | 1.21538 | 1.21529 | |||||
41 | 1.21538 | 1.21520 | |||||
42 | 1.21538 | 1.21529 | |||||
43 | 1.21538 | 1.21520 | |||||
44 | 1.21538 | 1.21529 | |||||
45 | 1.21537 | 1.21529 | |||||
46 | 1.21537 | 1.21529 | |||||
47 | 1.21520 | 1.21514 | 1 | 0 | |||
48 | 1.21522 | 1.21514 | |||||
49 | 1.21518 | 1.21511 | |||||
50 | 1.21518 | 1.21512 | 1 | 1 | |||
51 | 1.21520 | 1.21512 | |||||
52 | 1.21522 | 1.21514 | |||||
Sheet5 |
Explanation:
Let say Current Value Column D = B , Previous Value Column D = b ... Current Value Column C = A , Previous Value Column C = a
When there is a value in Column F ( F2<>"" / F2>0 ), count how many set ranges in Column C&D meet condition of both : a>=A AND b<=B . Stop count when one of it does not meet condition.
Example Row 3 : There is value in F3, so count how many set ranges meet condition a>=A AND b<=B , there is none, 0.
Example Row 29 : There is value in F29, there are 11 set ranges meet condition from row 28 to row 18 (Column C&D), stop at row 17 because 1.21514 (a) < 1.21517 (A)
Problem a bit similar to post Assign "1" but the difference are:
1. This post is about Count while previous post is about Assign.
2. This post is focus on previous cell/above row when there is value in Column F while previous post is assign from F2 to last row.