+ Reply to Thread
Results 1 to 12 of 12

Problem with CODE and CHAR functions

  1. #1
    Registered User
    Join Date
    06-16-2016
    Location
    Greece
    MS-Off Ver
    2013
    Posts
    69

    Problem with CODE and CHAR functions

    Yeah, attached image is obviously not working. Trying again...
    Καταγραφή.PNG
    Last edited by nick93; 06-16-2016 at 02:48 PM.

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Problem with CODE and CHAR functions

    Images don't work, try explaining your problem and attaching a workbook with a sample if necessary.

    edit:-

    Managed to get your image to load.

    When the CODE function returns 63, it can mean a Unicode character, which would have a code higher than 255 ( the limit for the code function).

    As it appears you already know, ö should return 246 as a character code, likewise, CHAR(246) should return ö and not ɸ which is Unicode character 632.

    You're profile says you're using excel 2013, try =UNICODE(E2) and see what that returns.
    Last edited by jason.b75; 06-16-2016 at 03:42 PM.

  3. #3
    Registered User
    Join Date
    06-16-2016
    Location
    Greece
    MS-Off Ver
    2013
    Posts
    69

    Re: Problem with CODE and CHAR functions

    Quote Originally Posted by jason.b75 View Post
    Images don't work, try explaining your problem and attaching a workbook with a sample if necessary.

    edit:-

    Managed to get your image to load.

    When the CODE function returns 63, it can mean a Unicode character, which would have a code higher than 255 ( the limit for the code function).

    As it appears you already know, ö should return 246 as a character code, likewise, CHAR(246) should return ö and not ɸ which is Unicode character 632.

    You're profile says you're using excel 2013, try =UNICODE(E2) and see what that returns.
    Thanks for the response, even though not only I never managed to get the attachment working but I also accidentally erased my post. The problem was that, I've been reading a textbook and one of the examples was demonstrating how to use international / Unicode characters (the book also had sample files). In one of those fiels they had ö in one of the cells and then they referenced that cell in a CODE formula. In the image shown in the book, the result of this function is actually 246. However on my PC, it says 63. Obviously 63 is incorrect; I know that because code(63) is simply a question mark. Code(246) also does not work, even though according to the book it should.

    The UNICODE formula works; it returns 246. What I want to know is, why does my textbook says it should work but it doesn't? Is the problem the fact that my computer is running a Greek version of Windows?

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Problem with CODE and CHAR functions

    It could be related to the version of windows, without having the exact same setup to test theory it is impossible to say for certain.

    I was trying to help another member with a completely different problem yesterday, but there were similar issues where things were not doing as expected.

    Possibly it is down to different settings on your computer being in different languages (Greek windows running in English?) could mean that some irregular fonts are used to display certain characters.

    Hold down the Alt key and type 0246 on the number keypad, that should show ö

    Try it in excel and in the browser, are the results different?

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Problem with CODE and CHAR functions

    However on my PC, it says 63. Obviously 63 is incorrect; I know that because code(63) is simply a question mark.
    That means it's a Unicode character, not the character from the standard extended ASCII code page.

    If you paste it in a post, I'll tell you what it is.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Problem with CODE and CHAR functions

    Quote Originally Posted by shg View Post
    If you paste it in a post, I'll tell you what it is.
    In the OP's absence, my observations so far.

    The character in the image, located in E2 is ö

    OP is saying that =CODE(E2) incorrectly returns 63. =UNICODE(E2) correctly returns 246.

    As 246 falls within the boundaries of the ANSI character set, surely CODE should work correctly?

    The image also indicates that =CHAR(246) which should return ö actually returns ɸ which is Unicode character 0632.

    I'm wondering if the CODE runs with a different character set on a Greek operating system, I've been looking around but so far not found anything where 246 refers to the ɸ character.

  7. #7
    Registered User
    Join Date
    06-16-2016
    Location
    Greece
    MS-Off Ver
    2013
    Posts
    69

    Re: Problem with CODE and CHAR functions

    Hey. Alt + 0246 correctly returns ö in Excel (and, of course, in my browser).. However when I use CODE on it, it returns 63. It's seriously puzzling me.
    I'm running Greek Windows but Office is in English. I guess I'll also try it tomorrow on my work's laptop (which is in English).

  8. #8
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Problem with CODE and CHAR functions

    Would you mind running a test on the full ANSI character set? I'm curious to see what else occurs.

    On a blank sheet, enter this formula into A1, then drag it right to column Z and down to row 10. (Z6:Z10 should show #VALUE! errors, the rest should show characters).

    In A11, enter =CODE(A1) then drag right to column Z and down to row 20, this should show the codes for the characters returned by the first formula.

    The numbers should run consecutive, 1 to 10 in column A, 11 to 20 in column B, etc. up to 255 in Z15 (Z16:Z20 should show errors again).

    If you autofit the columns, it should fit into a screen capture.

    I'll look into this some more tomorrow, hopefully shg, or other members, will notice something obvious that I have missed.
    Last edited by jason.b75; 06-16-2016 at 05:11 PM.

  9. #9
    Registered User
    Join Date
    06-16-2016
    Location
    Greece
    MS-Off Ver
    2013
    Posts
    69

    Re: Problem with CODE and CHAR functions

    Quote Originally Posted by jason.b75 View Post
    Would you mind running a test on the full ANSI character set? I'm curious to see what else occurs.

    On a blank sheet, enter this formula into A1, then drag it right to column Z and down to row 10. (Z6:Z10 should show #VALUE! errors, the rest should show characters).

    In A11, enter =CODE(A1) then drag right to column Z and down to row 20, this should show the codes for the characters returned by the first formula.

    The numbers should run consecutive, 1 to 10 in column A, 11 to 20 in column B, etc. up to 255 in Z15 (Z16:Z20 should show errors again).

    If you autofit the columns, it should fit into a screen capture.

    I'll look into this some more tomorrow, hopefully shg, or other members, will notice something obvious that I have missed.
    Hi, you didn't write the formula but I think this is what you are asking for (hope the image gets uploaded this time)
    aBp0YZ5.png

  10. #10
    Registered User
    Join Date
    06-16-2016
    Location
    Greece
    MS-Off Ver
    2013
    Posts
    69

    Re: Problem with CODE and CHAR functions

    Urgh, sorry for the double post but I still can't figure out how to upload an image, anyway here's a direct imgur link
    http://i.imgur.com/aBp0YZ5.png
    It would appear that the second half of the ASCII set is made up of Greek characters...

  11. #11
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Problem with CODE and CHAR functions

    Oops, copied the formula from excel, forgot to paste. Should have been =CHAR(ROW(A1)+((COLUMN(A1)-1)*10))

    Looks like you figured it out thought,

    That explains it, your settings have a different character set, where you have Greek characters, I have the accented characters typically used in western Europe, which is probably what your textbook refers to.

    If you use the formula from above in A11:Z20, changing CHAR to UNICHAR, you will be able to compare the 2 character sets.

    For the purpose of what you are trying, it might be best to use UNICHAR and UNICODE in place of CHAR and CODE, then what you are doing should match up with your textbook.

    edit:-

    jpeg images show up on the forum, png don't. They can be viewed, if not blocked by security settings, but not as easily as other types.
    Last edited by jason.b75; 06-16-2016 at 05:35 PM.

  12. #12
    Registered User
    Join Date
    06-16-2016
    Location
    Greece
    MS-Off Ver
    2013
    Posts
    69

    Re: Problem with CODE and CHAR functions

    Thanks a million guys. The problem has been solved. For the record, using UNICHAR and UNICODE instead of CHAR and CODE fixes the problem. Appreciate the answers.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Char & Code Formulas
    By penexcel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-29-2013, 10:08 PM
  2. min and char functions
    By MarkSidell in forum Excel General
    Replies: 2
    Last Post: 11-01-2011, 04:18 PM
  3. apps pro xy char labeler problem
    By kfitzpat in forum Excel General
    Replies: 1
    Last Post: 07-23-2010, 04:47 AM
  4. [SOLVED] 8500 cells with phone number(7 char.), wishing to add area code (10 char.)
    By moparz@gmail.com in forum Excel General
    Replies: 6
    Last Post: 03-10-2006, 01:15 PM
  5. My problem with char(30)
    By omikron123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2006, 03:46 PM
  6. [SOLVED] Problem in compiling code containing "$" char
    By Alain79 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-30-2005, 05:07 AM
  7. ALT + enter or Char(13) in code
    By JL in forum Excel General
    Replies: 3
    Last Post: 04-08-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1