Right() not working

keithm1

New Member
Joined
Nov 14, 2014
Messages
2
I am trying to extract a number from the text string "10~13" located at Col A, Row 3 by using the formula RIGHT(A3,2) located in B3. I get the result in B3 of "13". But when I test it with the formula IF(B3=13,"Y","N") located in C3, I get the result "N". I have tested the length of B3 with LEN(B3) in D4 and get the result of "2". The format for Cell B3 is "Number" with no decimals. How can I extract the number from Cell A3 and have it equal the number to satisfy the IF test?
keithm1
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I am trying to extract a number from the text string "10~13" located at Col A, Row 3 by using the formula RIGHT(A3,2) located in B3. I get the result in B3 of "13". But when I test it with the formula IF(B3=13,"Y","N") located in C3, I get the result "N". I have tested the length of B3 with LEN(B3) in D4 and get the result of "2". The format for Cell B3 is "Number" with no decimals. How can I extract the number from Cell A3 and have it equal the number to satisfy the IF test?
keithm1
The RIGHT function returns text that looks like a number... you are trying to compare it to a real number which is a completely different thing. Try putting quote marks around the 13 so the equality test will be text against text.
 
Upvote 0
Welcome to the board.

The RIGHT function returns a TEXT string, not a Number (regardless of how the cell is formatted)
This is also true for many other funcitons like LEFT, MID, SUBSTITUTE, REPLACE

So you would do
IF(B3="13","Y","N")

Hope that helps.
 
Upvote 0
Thank all of you for your quick response and helpful suggestions. I'm glad to discover the "Value" function which I never used before. It solved the problem. The other solutions would also have worked but the Value function is easiest for my application. Thank you, thank you, thank you... Keith
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

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