Excel Formula - How Many Times a Value Appears

ststern45

Well-known Member
Joined
Sep 17, 2005
Messages
974
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hi everyone,

Have a request for a formula.

In cell A10 I have a value of 1

Cell A15 I would have the formula that would do the following:

I know the value 1 is in cell A20. I want to count how many times the value 1 repeated below cell A20 before the value changed. So in the example below the total or result would be 2 since the 1 appeared in cell A20 and also A21 before the value 0 appeared in cell A22.
So in simple terms how many times did a value repeat based on what the value is in A20 only.


Cell range A20 through A30 contain the following values

A20 = 1
A21 = 1
A22 = 0
A23 = 0
A24 = 0
A25 = 1
A26 = 2
A27 = 0
A28 = 1
A29 = 0
A30 = 1

Thanks in advance!!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
How about
=MATCH(TRUE,(A20:A30<>A20),0)-1

This needs to be confirmed with Ctrl Shift Enter
 
Upvote 0
I was thinking similar but needs the reference to A10 ??

=MATCH(FALSE,A20:A1000=A10,0)-1

Again Ctrl+Shift + Enter

Hope that helps.
 
Upvote 0
Wasn't sure if it should be A10 or A20, I went with A20 based on this
based on what the value is in A20 only
We'll just have to wait & see
 
Upvote 0
Thanks the A10 contained the most recent value = 1
I only tried the =MATCH(FALSE,A20:A1000=A10,0)-1 and worked to perfection.

Sorry about the confusion. I did change the cell to A20 instead of A10

Thank you all!!
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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