Find last then count

fromspenny

New Member
Joined
Feb 17, 2011
Messages
39
Hi all could use your help on this one
What I am trying to do is find the last w and from that point count the remaining items in the list so in this example the answer would be 3 thanks in advance

Excel Workbook
A
1L
2W
3D
4L
5W
6L
7L
8D
9W
10W
11W
12L
13D
14L
15D
16L
17W
18L
19L
20W
21W
22D
23D
24L
25D
26D
27W
28D
29L
30L
31W
32L
33D
34D
35
36
37
38
Sheet1
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
maybe a single line of VBA?
Code:
MsgBox Range("A:A")(Rows.Count).End(3).Row - Range("A:A").Find("W", searchdirection:=xlPrevious).Row
 
Upvote 0
Hi all could use your help on this one
What I am trying to do is find the last w and from that point count the remaining items in the list so in this example the answer would be 3 thanks in advance

Excel Workbook
A
1L
2W
3D
4L
5W
6L
7L
8D
9W
10W
11W
12L
13D
14L
15D
16L
17W
18L
19L
20W
21W
22D
23D
24L
25D
26D
27W
28D
29L
30L
31W
32L
33D
34D
35
36
37
38
Sheet1
Assuming there will always be at least one instance of "W"...

=COUNTA(A100:INDEX(A:A,LOOKUP(2,1/(A1:A100="w"),ROW(A1:A100))+1))
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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