Count backward the # if times a text shows up since another text?

650nmWolf

New Member
Joined
Dec 26, 2017
Messages
14
I am trying to count the number of times a certain text shows up in a row since the last time another text shows up in that row. Example: I would like to know the number of times the word "apple" shows up since the word "orange" showed up. C2 is "orange," H2 is "apple," L2 is "orange," then N2 is "apple," and Q2 is "apple." Is there a formula to count "apples" since the last "orange?" The answer going backwards (toward column A) would be 2. Is that even possible?:eek:
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Assuming data in A2:Z2, maybe...

=COUNTIF(INDEX(A2:Z2,LOOKUP(2,1/(A2:Z2="orange"),COLUMN(A2:Z2)-COLUMN(A2)+1)):Z2,"apple")

M.
 
Upvote 0
Marcelo,
Thanks so much for helping me with this. I am trying to work that formula into my spreadsheet. It is taking me a little time since I am unfamiliar with some of the functions and I think I oversimplified my question to the forum. I will crank this into my numbers and hopefully come back with a more intelligent question. Great stuff so far! thank you!
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,657
Members
449,462
Latest member
Chislobog

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