Two different characters returning same code

CMIIandExcel

Board Regular
Joined
Sep 4, 2009
Messages
190
Hi all

I am a bit mythed by an issue I am having in Excel 2010.

I have two different characters displaying as - and ? but are both returning 63 from CODE().

I know the - should return 45.

Anyone got any ideas how this can be happening?

Thanks in advance for any assistance

Mike


Background:

Somone was copy and pasting values from an excel workbook into a database search and the db was not returning any hits. when the - in the search criteria were removed and replaced with wildcards the search returned hits.

They then sent the number to me via office communicator (Copied and pasted below)
CRL1‐XRL‐Z3‐ADDSD‐CR001‐50147
Where it no longer displayed as a - but as a non printable character (empty square).
I then copied this back into excel and it again displayed as -.

I then used CODE() and CHAR() to try and see what was what.


CharacterCODE()
-45
?63
-63

<TBODY>
</TBODY>

The first row is a typed in -
The second row is a typed in ?
The last row is the - from the pasted value


 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
and btw its the same problem for all office versions at least from 2003 don't know earlier version.
 
Upvote 0
CODE only understands ASCII characters (ie. char(1) to char(255)) whereas what you are pasting from the internet may well include unicode characters.
 
Upvote 0
Hi

If you want to know the real code of the character, you must use vba.

For ex., to know the code of the 5th character in the cell A1, execute in the Immediate Window:

?AscW(Mid(Range("A1").Value,5,1))
 
Upvote 0
Thanks for the pointers, seems the original values which were put into the spreadsheet were taken from a pdf document.

Regards

Mike
 
Upvote 0

Forum statistics

Threads
1,216,859
Messages
6,133,104
Members
449,778
Latest member
dep1969

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