# Formula Help: Find the largest number that ends with a certain digit

#### Chris The Rock

##### Active Member
I know the =LARGE() function finds the kth largest number in an array.

I need to build a formula that finds the kth largest number in an array - when the number ends with a specified digit.

Data like this:
11
51
31
21
41
would give the result 51, if I'm looking for numbers ending in 1.
This:
7
27
47
87
would return 87, if I want a number ending in 7.

Finally, data like this:
11
23
34
89
27
16
would return 16, if I'm searching for the largest number ending in 6.

I'd like to do this without writing a custom function in VBA.

Any suggestions?

Last edited:

### Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Maybe try this:

=LARGE(IF(RIGHT(G1:G100,1)="6",G1:G100),1)

This needs to be confirmed with control+shift+enter and not just enter.

Hope that helps.

Maybe try this:

=LARGE(IF(RIGHT(G1:G100,1)="6",G1:G100),1)

This needs to be confirmed with control+shift+enter and not just enter.

Hope that helps.

An array formula is almost certainly what I need, but that formula doesn't work because it's comparing text values (RIGHT) with numeric values (LARGE). However, it gives me a good place to start.

Thanks!

An array formula is almost certainly what I need, but that formula doesn't work because it's comparing text values (RIGHT) with numeric values (LARGE). However, it gives me a good place to start.

Thanks!

I just stuck a "1*" in front of the IF statement and it does just what I want.

An array formula is almost certainly what I need, but that formula doesn't work because it's comparing text values (RIGHT) with numeric values (LARGE). However, it gives me a good place to start.

Thanks!
Not sure what you mean? I put ="6" so it looked at a text value, but you could also use:

=LARGE(IF(RIGHT(G1:G100,1)+0=6,G1:G100),1)

But everything in the list would need to be a number?

maybe:

=LARGE(IF(MOD(G1:G100,10)=6,G1:G100),1)

Confirm with Ctrl+Shift+Enter

Denis

Not sure what you mean? I put ="6" so it looked at a text value, but you could also use:

=LARGE(IF(RIGHT(G1:G100,1)+0=6,G1:G100),1)

But everything in the list would need to be a number?

Everything works, but it was necessary for everything in the list to be a number.

Thank you everyone for jogging my memory and helping me solve this mystery.

Replies
2
Views
344
Replies
7
Views
645
Replies
1
Views
85
Replies
2
Views
514
Replies
1
Views
238

1,217,476
Messages
6,136,876
Members
450,029
Latest member
MissQuotation

### 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.

### Which adblocker are you using?

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

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