+ Reply to Thread
Results 1 to 10 of 10

CHAR in =IF function.

  1. #1
    Registered User
    Join Date
    06-29-2016
    Location
    singapore
    MS-Off Ver
    office, excel, pp
    Posts
    14

    CHAR in =IF function.

    Hi,

    How I do i use CHAR in a =IF formula? (or something similar)

    e.g. =IF(A1=1,1,0)

    i get either 1 or 0 depending on A1 value.

    but if i want something like

    e.g. =IF(CHAR(Y)=1,1,0)

    i get 1 if it Y and 0 is it not Y.

    Any idea?

    Thanks!!

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: CHAR in =IF function.

    CHAR returns Character
    CODE returns number

    Maybe you need CODE to compare with value?
    Quang PT

  3. #3
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: CHAR in =IF function.

    Yea... CHAR(89) = Y or CHAR(121) = y Capital/Lower

    What are you trying to do... if you want to say if it equals Y just put Y... = IF(A1="Y",1,0)

    Char Table
    Attachment 476368

    And now that I think about it...are you trying to count if it contains a Y?

    = Countifs(A1,"*Y*") The * asterisk symbol is a wildcard and says if anything comes before and after ignore it...count if everything between the two * exists...in this case Y... So count if it contains a Y

    Really would help to know what you are thinking and or why you are doing this.
    Last edited by ELeGault; 08-21-2016 at 11:39 PM.
    -If you think you are done, Start over - ELeGault

  4. #4
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    Re: CHAR in =IF function.

    I believe he is asking how to make it check if there is text in the form of "Y" in cell A1.

    That can be done by:

    =IF(A1="Y",1,0)

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: CHAR in =IF function.

    If you want to test for a letter in a cell, why not just test for that letter?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    06-29-2016
    Location
    singapore
    MS-Off Ver
    office, excel, pp
    Posts
    14

    Re: CHAR in =IF function.

    Quote Originally Posted by bebo021999 View Post
    CHAR returns Character
    CODE returns number

    Maybe you need CODE to compare with value?
    Hi,

    Is something like if i key in Y, it will be 1, if no then 0.

  7. #7
    Registered User
    Join Date
    06-29-2016
    Location
    singapore
    MS-Off Ver
    office, excel, pp
    Posts
    14

    Re: CHAR in =IF function.

    Quote Originally Posted by ELeGault View Post
    Yea... CHAR(89) = Y or CHAR(121) = y Capital/Lower

    What are you trying to do... if you want to say if it equals Y just put Y... = IF(A1="Y",1,0)

    Char Table
    Attachment 476368

    And now that I think about it...are you trying to count if it contains a Y?

    = Countifs(A1,"*Y*") The * asterisk symbol is a wildcard and says if anything comes before and after ignore it...count if everything between the two * exists...in this case Y... So count if it contains a Y

    Really would help to know what you are thinking and or why you are doing this.
    Hi,

    Yeah, it worked with the "".

    Thanks!!

  8. #8
    Registered User
    Join Date
    06-29-2016
    Location
    singapore
    MS-Off Ver
    office, excel, pp
    Posts
    14

    Re: CHAR in =IF function.

    Quote Originally Posted by TheN View Post
    I believe he is asking how to make it check if there is text in the form of "Y" in cell A1.

    That can be done by:

    =IF(A1="Y",1,0)
    Hi,

    Yes. Thank you!

  9. #9
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: CHAR in =IF function.

    Maybe like this ...

    =--(A1="Y")

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: CHAR in =IF function.

    Also note that in most cases Excel will evaluate that "Y" and "y" are the same.

    If you need to distinguish between upper and lower case then you'll need something different.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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 (10) function not working
    By saigalp in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 04-01-2020, 07:16 AM
  2. [SOLVED] How to combine FINDing CHAR(42) and CHAR(47) in 1 formula
    By RJK in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 07-05-2015, 02:54 AM
  3. [SOLVED] Function to take text from x:th char to next n char
    By Temporary-Failure in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-07-2013, 02:19 AM
  4. Changing a single Char in a string to another ASCII char
    By goofy78270 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2007, 09:45 AM
  5. [SOLVED] string/char CONTAINS function?
    By jim sturtz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-31-2006, 02:20 PM
  6. Replies: 6
    Last Post: 03-10-2006, 01:15 PM
  7. [SOLVED] How can I use CHAR() function in VB?
    By Basil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2005, 01:05 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