Multiple Occurances of a following value

Golpha

New Member
Joined
Aug 5, 2019
Messages
4
Is there a way, given a 3000 rows x 5 columns set of data, to find out how many times in that set a certain value (text or number) follows another value, either 1, 2 or 3 rows after?

Thanks
Golpha
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Welcome to the Board.

Try:


Book1
ABCDEFGHI
1axcatValue1Value21 row after2 rows after3 rows after
21ydoga1532
32amouse
432a
5411
6aa1
7131
821horse
93b1
104b2
11aba
122b8
134c8
146a1
1571a
16b2bc
17a3de
1814f
192x
203g
Sheet2
Cell Formulas
RangeFormula
G2=COUNTIFS(A1:C20,E2,A2:C21,F2)
H2=COUNTIFS(A1:C20,E2,A3:C22,F2)
I2=COUNTIFS(A1:C20,E2,A4:C23,F2)
 
Upvote 0
Thanks Eric
That worked a little. But if I'm looking for how many times "a" followed "1", regardless of the column, it only counts the instances when they are in the same column. Is there away to have excel look in any column in the following 1st, 2d or 3rd row?
 
Upvote 0
If you're looking for b's that follow a's, and you have a in A1 and C1, and there's a b in B2, does that count as 1 or 2?
 
Upvote 0
Maybe:


Book1
ABCDEFGHIJK
1axcat4xValue1Value21 row after2 rows after3 rows after
21ydog1ra1847
32amousecat
432a1a
5411x2
6aa1y1
7131z1
821horsea1
93b1x1
104b2y7
11aba1a
122b8xb
134c8tcat
146a1ycat
1571aud
16b2bci1
17a3deo2
1814fp3
192x
203g
Sheet1
Cell Formulas
RangeFormula
I2=SUMPRODUCT(SIGN(MMULT(--(A1:E20=G2),{1;1;1;1;1})),SIGN(MMULT(--(A2:E21=H2),{1;1;1;1;1})))
J2=SUMPRODUCT(SIGN(MMULT(--(A1:E20=G2),{1;1;1;1;1})),SIGN(MMULT(--(A3:E22=H2),{1;1;1;1;1})))
K2=SUMPRODUCT(SIGN(MMULT(--(A1:E20=G2),{1;1;1;1;1})),SIGN(MMULT(--(A4:E23=H2),{1;1;1;1;1})))
 
Upvote 0
Maybe:

ABCDEFGHIJK
1axcat4xValue1Value21 row after2 rows after3 rows after
21ydog1ra1847
32amousecat
432a1a
5411x2
6aa1y1
7131z1
821horsea1
93b1x1
104b2y7
11aba1a
122b8xb
134c8tcat
146a1ycat
1571aud
16b2bci1
17a3deo2
1814fp3
192x
203g

<colgroup><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
I2=SUMPRODUCT(SIGN(MMULT(--(A1:E20=G2),{1;1;1;1;1})),SIGN(MMULT(--(A2:E21=H2),{1;1;1;1;1})))
J2=SUMPRODUCT(SIGN(MMULT(--(A1:E20=G2),{1;1;1;1;1})),SIGN(MMULT(--(A3:E22=H2),{1;1;1;1;1})))
K2=SUMPRODUCT(SIGN(MMULT(--(A1:E20=G2),{1;1;1;1;1})),SIGN(MMULT(--(A4:E23=H2),{1;1;1;1;1})))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

You are a GENIUS!!!!!!!!!
Thank you so much!
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,792
Members
449,048
Latest member
greyangel23

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