Help, required single formula, instead of using 3

Kishan

Well-known Member
Joined
Mar 15, 2011
Messages
1,645
Office Version
  1. 2010
Platform
  1. Windows
Using Excel 2000</SPAN></SPAN>
Hi,
</SPAN></SPAN>

To get final result in the column K, I am using 2 more formula in the column E & G, please can someone make a single formula in the column K.
</SPAN></SPAN>

Using example....
</SPAN></SPAN>


Book1
ABCDEFGHIJKLM
1
2
3
4
5P3111
61101
72011
81101
91202
101303
11X011
121101
13X011
141101
15X011
16X022
17X033
181101
191202
201303
211404
22X011
231101
241202
251303
261404
27X011
281101
291202
301303
311404
321505
331606
341707
351808
36X011
371101
381202
392011
401101
41X011
422022
431101
44
45
46
Sheet2
Cell Formulas
RangeFormula
E6=IF(C6=1,1,0)
E7=IF(C7=1,1+E6,0)
E8=IF(C8=1,1+E7,0)
G6=IF(C6=1,0,1)
G7=IF(C7=1,0,1+G6)
G8=IF(C8=1,0,1+G7)
K6=IF(E6>0,E6,G6)
K7=IF(E7>0,E7,G7)
K8=IF(E8>0,E8,G8)


Thank you in advance
</SPAN></SPAN>

Regards,
</SPAN>
Kishan
</SPAN></SPAN>
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Maybe...


C
D
E
F
G
5
P3​
6
1​
1​
7
2​
1​
8
1​
1​
9
1​
2​
10
1​
3​
11
X​
1​
12
1​
1​
13
X​
1​
14
1​
1​
15
X​
1​
16
X​
2​
17
X​
3​
18
1​
1​
19
1​
2​
20
1​
3​
21
1​
4​
22
X​
1​
23
1​
1​
24
1​
2​
25
1​
3​
26
1​
4​
27
X​
1​
28
1​
1​
29
1​
2​
30
1​
3​
31
1​
4​
32
1​
5​
33
1​
6​
34
1​
7​
35
1​
8​
36
X​
1​
37
1​
1​
38
1​
2​
39
2​
1​
40
1​
1​
41
X​
1​
42
2​
2​
43
1​
1​

Formula in G6 copied down
=IF(C6=1,COUNTIF(C6:INDEX(C$6:C6,IF(COUNTIF(C$6:C6,"<>1")=0,1,LOOKUP(2,1/(C$6:C6<>1),ROW(C$6:C6)-ROW(C$6)+1))),1),COUNTIF(C6:INDEX(C$6:C6,IF(COUNTIF(C$6:C6,1)=0,1,LOOKUP(2,1/(C$6:C6=1),ROW(C$6:C6)-ROW(C$6)+1))),"<>1"))

Hope this helps

M.
 
Upvote 0
Maybe...

Formula in G6 copied down
=IF(C6=1,COUNTIF(C6:INDEX(C$6:C6,IF(COUNTIF(C$6:C6,"<>1")=0,1,LOOKUP(2,1/(C$6:C6<>1),ROW(C$6:C6)-ROW(C$6)+1))),1),COUNTIF(C6:INDEX(C$6:C6,IF(COUNTIF(C$6:C6,1)=0,1,LOOKUP(2,1/(C$6:C6=1),ROW(C$6:C6)-ROW(C$6)+1))),"<>1"))

Hope this helps

M.
Marcelo Branco, thank you for your help the formula worked fine.</SPAN></SPAN>

Kind Regards
</SPAN></SPAN>
Kishan :)
</SPAN></SPAN>
 
Upvote 0
How about:

K6: =IF(C6=1,IF(C5=1,K5+1,1),IF(C5<>1,K5+1,1))
Eric W, thanks for a formula, the formula look to me tiny and magical :mad: results splendid as appeal</SPAN></SPAN>

Kind Regards,
</SPAN>
Kishan :biggrin:
</SPAN></SPAN>
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,213
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top