• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Repeated and Restart Text

Hi,

So only ever two criteria? Never more? If so, in B6:

=IF(INT(MOD(ROWS(B$6:B6)-1,C$2+C$3)/C$2),B$3,B$2)

and copied down.

Regards
 
A general formula for an arbitrary number of fruit types:
= LOOKUP( 1+MOD(k-1, n), accumulated, fruit)
where k is the number column to the left, accumulated is the count corresponding to the first fruit of a new type. For the problem as stated this was {1;4} but, when I inserted a couple of bananas into the list, it became {1;4;6} with a total count, n, of 10.

If you have the new XLOOKUP function, it will work with the final accumulated count for each fruit type {3;5;10}, in which case the formula is
= XLOOKUP( 1+MOD(k-1,n), accumulated, fruit, , 1 )
 
Back
Top