instead of index count

jimblimm

Board Regular
Joined
May 11, 2012
Messages
219
i have this formula,

=INDEX($A$21:$A$8517,MATCH(2,1/(MMULT((COUNTIF(OFFSET('MAIN DATA'!B21:B8517,(ROW(INDIRECT("1:"&ROWS('MAIN DATA'!B21:B8517)-B5+1))-1)+{-1,0,1},0,(B5+1)),B3)=(B5+1)+{-1,0,-1})+0,{1;1;1})=3),1)+(B5+1)-1))

is there a way to make the formula count the occurrence instead of indexing
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Try...

=SUM(IF(FREQUENCY(IF('MAIN DATA'!B21:B8517=B3,ROW('MAIN DATA'!B21:B8517)),IF('MAIN DATA'!B21:B8517<>B3,ROW('MAIN DATA'!B21:B8517)))=(B5+1),1))
 
Upvote 0
WORKS PERFECT!

on another note
is there a way to make the last value of streak be something other than identical values

using same formula

INDEX($A$21:$A$8517,MATCH(2,1/(MMULT((COUNTIF(OFFSET('MAIN DATA'!B21:B8517,(ROW(INDIRECT("1:"&ROWS('MAIN DATA'!B21:B8517)-B5+1))-1)+{-1,0,1},0,(B5+1)),B3)=(B5+1)+{-1,0,-1})+0,{1;1;1})=3),1)+(B5+1)-1))

the b3 is the streaking value

could i add something to make the last value be somehting else
ex c3

example b5+1= 4

b3="s"

c3="t"

so the formula should look for
s
s
s
s
t
 
Upvote 0
say for instance i have

a1:a15 b1:b15
1 s
2 s
3 s
4 s
5 t
6 s
7 s
8 t
9 s
10 s
11 s
12 t
13 s
14 s
15 t

i want to know how many times

1. "s" streak 4times then "t" was next value
example
s
s
s
s
t

the ref value "s" is in d1
the ref value "t" is in e1
the ref of streak, 4 or whatever number i wanna lookup is in f1

answer in g1=1

and also add the index the last time the occurrence showed up of it to h1
h1=5
 
Upvote 0
i want to know how many times "s" streak 4 times then "t" was next value

Confirmed with Ctrl+Shift+Enter:

=SUMPRODUCT(--(FREQUENCY(IF(B1:B15="s", ROW(B1:B15)), IF(B1:B15="t", ROW(B1:B15)))=4))
 
Upvote 0

Forum statistics

Threads
1,215,412
Messages
6,124,761
Members
449,187
Latest member
hermansoa

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