Find the address of the last value in a row, greater than zero, that is less than the value of a specific cell

Trickle

New Member
Joined
Feb 23, 2012
Messages
12
Hi All

I am looking for a formula that would give me the address of the cell furthest right in a row that contains a value less than that specified in a particular cell.

For example:

1689802925118.png


Could anyone please suggest a formula in N1 that would give me the address of the cell furthest right in the range A1:M1, which contains a value less than the value in P1, where the result is not blank or zero (in this example G1?)

Many thanks in advance for any help.

Best regards

Trickle
 

Attachments

  • 1689802267581.png
    1689802267581.png
    15.4 KB · Views: 5
  • 1689802308239.png
    1689802308239.png
    12 KB · Views: 7

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
try this:
Book1
ABCDEFGHIJKLMNOP
1109.81211.51110.5111212.50$G$111.5
Sheet4
Cell Formulas
RangeFormula
N1N1=ADDRESS(ROW(INDEX(A1:M1,1,MAX((--(A1:M1)<>"")*(--(A1:M1<>0))*(--(A1:M1<=P1))*COLUMN(A1:M1)))), COLUMN(INDEX(A1:M1,1,MAX((--(A1:M1)<>"")*(--(A1:M1<>0))*(--(A1:M1<=P1))*COLUMN(A1:M1)))))
 
Upvote 0
try this:
Book1
ABCDEFGHIJKLMNOP
1109.81211.51110.5111212.50$G$111.5
Sheet4
Cell Formulas
RangeFormula
N1N1=ADDRESS(ROW(INDEX(A1:M1,1,MAX((--(A1:M1)<>"")*(--(A1:M1<>0))*(--(A1:M1<=P1))*COLUMN(A1:M1)))), COLUMN(INDEX(A1:M1,1,MAX((--(A1:M1)<>"")*(--(A1:M1<>0))*(--(A1:M1<=P1))*COLUMN(A1:M1)))))

all the double hyphens may not be needed, it is just a habit of mine.
 
Upvote 0
your post title mentions > 0 but the main post does not. The above doesn't exclude negative numbers. but can be changed with this (i have not verified it though):

Excel Formula:
=ADDRESS(
ROW(INDEX(A1:M1,1,MAX((--(A1:M1)<>"")*(--(A1:M1>0))*(--(A1:M1<=P1))*COLUMN(A1:M1)))),
COLUMN(INDEX(A1:M1,1,MAX((--(A1:M1)<>"")*(--(A1:M1>0))*(--(A1:M1<=P1))*COLUMN(A1:M1)))))
 
Upvote 0
or this little shorter formula:
Excel Formula:
= ADDRESS(1,XMATCH(MAXIFS(A1:M1,A1:M1,"<"&P1),A1:M1,-1,-1))

EDIT:
feel free to "adjust" the criteria: "<"&P1 which means "less then the value of cell P1"
Simply put your operator ("<=" or ">=" etc.) between the quotes.

EDIT2:
Had a typo at the beginning of the formula.
 
Last edited:
Upvote 0
Solution
or this little shorter formula:
Excel Formula:
= ADDRESS(A1,XMATCH(MAXIFS(A1:M1,A1:M1,"<"&P1),A1:M1,-1,-1),1,)

EDIT:
feel free to "adjust" the criteria: "<"&P1 which means "less then the value of cell P1"
Simply put your operator ("<=" or ">=" etc.) between the quotes.
not sure if user has XMATCH or MAXIFS functions.
Also, I think the first argument also should be Row(A1).
 
Last edited:
Upvote 0
Just out of bed in the UK. Many thanks Awoohaw and Pete for your help and for sharing your knowledge. I'll give this a go today and get back to you.

Best regards

Trickle
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also wondering why you want the address? Asking because many times similar questions have been asked it is to then use that cell address to do something else that can be done much more simply in another way without bothering with the address.
 
Upvote 0
Both long and short versions work perfectly. Many thanks, both for your help - it's much appreciated.

With best regards

Trickle
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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