Forum Discussion
txrussianguy
Mar 29, 2019Brass Contributor
counting contiguous cells
I need to count the contiguous cells on a row, to the right of a cell. Any way to do that (even though there may be other cells beyond it, and I won't have a firm number on how many that is at any g...
Twifoo
Mar 29, 2019Silver Contributor
You may try this formula in B2:
=COUNTA(C2:INDEX(2:2,COUNTA(2:2)))
=COUNTA(C2:INDEX(2:2,COUNTA(2:2)))
- TwifooMar 30, 2019Silver ContributorAll references in the formula are relative so that you can copy and paste it anywhere and it will return the count of data cells to the right of the cell where it’s entered.
- txrussianguyMar 31, 2019Brass Contributor
Twifoo, I think my original request must have not been clear enough. Attached example shows the two shaded cells, into which I need a formula (which I can copy into other cells of similar nature), where the immediately contiguous cells to the right of the formula, are the ones I need to count.
Hope that's now clearer.
- TwifooMar 31, 2019Silver ContributorThe formula in B2 is:
=MATCH(1,
INDEX(--(C2:$XFD2=""),0),
0)-1
- txrussianguyMar 30, 2019Brass Contributor
Twifoo, thanks (for your several responses), what if I don't know that it's row 2 in which I need this? This will go into varying rows, and those rows may shift over time with insertion above it, so I need that part of the formula to self-adjust with it. How would I alter this to accommodate for that?
Thanks again.