# Determine if last character meets condition

##### Active Member
Hello All

May I ask the board for help with a formula to find the last number in a cell and if that number meets a condition put a letter in the adjacent cell.

In cell A1 I have numbers as such 254671 (these numbers vary in length but not normally more than 8 in length). I want to know if the last numeral on the right is a 1 and if so then enter in the adjacent cell (B1) the letter y if not then leave blank.

Regards

### Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
In cell B1 enter the formula =IF(VALUE(RIGHT(A1,1))=1,"y","")

Last edited:
Hello JB Scotland

Many thanks for replying. When I enter your formula it returns the #value, will that be due to some unforeseen formatting?

Regards

You will get #VALUE if A1 is blank or contains text with no number at the right end. If you want to avoid the #VALUE error use this:

=IF(RIGHT(A1,1)="1","y","")

Hello JB Scotland

That works an absolute treat and many thanks for your help it is much appreciated.

Regards

Here are two more ways in which to do it...

=LEFT("Y",RIGHT(A1)="1")

=MID("Y",1,RIGHT(A1)="1")

Rick - neat.

In the same vein if you like your RIGHTS:

=RIGHT("Y",RIGHT(A1)="1")

Last edited:

Replies
5
Views
108
Replies
3
Views
169
Replies
7
Views
766
Replies
13
Views
569
Replies
4
Views
732

1,196,048
Messages
6,013,091
Members
441,747
Latest member
darkman77

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