Count all cell after 12 cell with zeros

cgsierra

Board Regular
Joined
Mar 21, 2011
Messages
142
Office Version
  1. 365
Hello,
I have a table that has the column titles as months, Jan 2018 through April 2022 and the y axis (row titles) as customers (ie 10,000 customers). The data is revenue.
I need a formula that I can place on the column that follows April 2022 that sums the Revenue after 12 consecutive cells (1 year of inactivity) with zeroes in them for each client. This period of 12 consecutive zeroes is different for each client and some don’t even have such period of inactivity. Your help would be greatly appreciated
Carlo
 
If you have the latest text functions (being rolled out gradually to 365 users so you may not have them yet) then it can be done much shorter like column BE below. I have also used column BD as @Anthony47 has done. For this sample data the formula returns the same results as @Anthony47's formula from post #16

cgsierra.xlsx
BCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBD
1Jan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18Jan-19Feb-19Mar-19Apr-19May-19Jun-19Jul-19Aug-19Sep-19Oct-19Nov-19Dec-19Jan-20Feb-20Mar-20Apr-20May-20Jun-20Jul-20Aug-20Sep-20Oct-20Nov-20Dec-20Jan-21Feb-21Mar-21Apr-21May-21Jun-21Jul-21Aug-21Sep-21Oct-21Nov-21Dec-21Jan-22Feb-22Mar-22Apr-22SUMConsec 0
28628556154665736755664939610717688475261778950618299666964336349555675329487709589337089955550187216909157035048739281235703937778719245927886339100630555619661932152887282862752969828591855149598704768689383012
3660772130000000000000000852100000000000059257005829495869353613591846180779570575347789275585181832481028796895682589279770416191111
479867830511652746046581469109135834153607380670456166213958398027764607775677476788872879937621193356699775572116557900350055494937682647065524561330000000000000000
57918706150485552525795688977605558316488636468818054580899099607756796299430845798705078538569958894777396489039838181498490697598137906796592535064811253108411854766629737679772366838502597333357114
673517792727795199242596190859165645893516844710357419563531395027893521265167327599953098593979971828995934089099465894555847263619786829439916481648712691264649057945486926858702357746280557556259198608073890
Foglio2
Cell Formulas
RangeFormula
BC2:BC6BC2=IFNA(SUM(--TEXTSPLIT(TEXTAFTER(TEXTJOIN(" ",0,--(B2:BA2)),REPT(" 0",MIN(BD2,12))&" ",-1)," ")),0)
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
If you have the latest text functions (being rolled out gradually to 365 users so you may not have them yet) then it can be done much shorter like column BE below.

=IFNA(SUM(--TEXTSPLIT(TEXTAFTER(TEXTJOIN(" ",0,--(B2:BA2)),REPT(" 0",MIN(BD2,12))&" ",-1)," ")),0)
Yeah, TEXTSPLIT is going to be an absolute game changer once it has been completely rolled out.
 
Upvote 0
Yeah, TEXTSPLIT is going to be an absolute game changer once it has been completely rolled out.
I think TEXTAFTER and TEXTBEFORE are just as useful. How many times do we add a heap of blanks then RIGHT/TRIM to get the last 1, 2 or 3 'words' from a cell or make an awkward SUBSTITUTE/FIND/LEFT type arrangement to get the first few "words"?
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

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