Consecutive Cell Formula

MIHeartandSoul

New Member
Joined
May 15, 2015
Messages
5
I am looking for assistance please. I am trying to count the number of 0's before there is a 1. Please see below...

[TABLE="width: 772"]
<colgroup><col><col span="12"></colgroup><tbody>[TR]
[TD]Store[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]Sum[/TD]
[/TR]
[TR]
[TD] 1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD] 2[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD] 3[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD] 4[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD] 5[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]


So with my example above store #1 has 1 '0' (column K) before there is a '1'.
Store #4 Has 8 '0's before there is a '1'.

Can anyone suggest a formula on how to do this calculation?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Your labeling is a little confusing... you seem to indicate your values are in Columns A:K, but that would mean the Store column would not exist? So I'll give you two formula for the two different possibilities and you pick the one that matches your actual setup.


Store in Column A, Data in Columns B:L
-------------------------------------------------------------------
=12-MAX((A2:L2=1)*COLUMN(A2:L2))


No Store column, data in Columns A:K
-------------------------------------------------------------------
=11-MAX((A2:K2=1)*COLUMN(A2:K2))


Note: Commit these formulas using CTRL+SHIFT+ENTER and not just Enter by itself
 
Upvote 0
Thank you so much for the fast reply. I am doing CTRL+SHIFT+ENTER and then pasting in the formula and I keep receiving: #value!. Any suggestions?

Your labeling is a little confusing... you seem to indicate your values are in Columns A:K, but that would mean the Store column would not exist? So I'll give you two formula for the two different possibilities and you pick the one that matches your actual setup.


Store in Column A, Data in Columns B:L
-------------------------------------------------------------------
=12-MAX((A2:L2=1)*COLUMN(A2:L2))


No Store column, data in Columns A:K
-------------------------------------------------------------------
=11-MAX((A2:K2=1)*COLUMN(A2:K2))


Note: Commit these formulas using CTRL+SHIFT+ENTER and not just Enter by itself
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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