finding a particular row number

User avatar
stuck
Panoramic Lounger
Posts: 8175
Joined: 25 Jan 2010, 09:09
Location: retirement

finding a particular row number

Post by stuck »

In the range A11:A21 I have formulae that either returns 'something' or says "not used". Depending on the data in the cells referenced by these formula the final one that does NOT return 'something' could be anywhere from A11 to A21. For example, cells A11:A14 could each be populated with 'something', then cells A15:A20 could be "not used" and then cell A21 be 'something'. Or A11:12 could be something then A13:A19 "not used", A20 'something' and A21 once again "not used". I'm trying to figure out the most elegant way of getting the row number of the last 'something'.

At the moment I'm using the range J11:J21 to display the row number if A11:A21 is 'something' and then above that range, in J10, I'm getting the MAX of the range (J11:J21). That does the job but I can't help feeling there's a neater way of doing this. Could it be done in a single cell, perhaps with some sort of array formula?

Ken

User avatar
HansV
Administrator
Posts: 78465
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: finding a particular row number

Post by HansV »

As an array formula, confirmed with Ctrl+Shift+Enter:

=MAX((A11:A21<>"not used")*ROW(A11:A21))

Remark: if ALL cells in A11:A21 contain "not used", this formula returns 0.
Best wishes,
Hans

User avatar
stuck
Panoramic Lounger
Posts: 8175
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: finding a particular row number

Post by stuck »

HansV wrote:As an array formula...
Thank you Hans :thumbup: That deserves a :chocciebar:

Ken

User avatar
HansV
Administrator
Posts: 78465
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: finding a particular row number

Post by HansV »

:yum:
Best wishes,
Hans