+ Reply to Thread
Results 1 to 9 of 9

Return specific value IF specific text in cell

Hybrid View

  1. #1
    Registered User
    Join Date
    01-13-2015
    Location
    Denmark
    MS-Off Ver
    2013
    Posts
    10

    Return specific value IF specific text in cell

    Hello!

    Say i want A1 to show a the number 123, if A2 contains the text abc.

    Wouldn't the function be:

    =IF(A2="abc", 123)

    Apparently this doesn't work. What am i doing wrong?

    Thanks in advance! :)

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Return specific value IF specific text in cell

    Key word seems to be 'contains' here

    =IF(ISNUMBER(FIND("abc",A2)),123,"")

    Remember FIND() is case-sensitive. You might want to use SEARCH()
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    01-13-2015
    Location
    Denmark
    MS-Off Ver
    2013
    Posts
    10

    Re: Return specific value IF specific text in cell

    Quote Originally Posted by Ace_XL View Post
    Key word seems to be 'contains' here

    =IF(ISNUMBER(FIND("abc",A2)),123,"")

    Remember FIND() is case-sensitive. You might want to use SEARCH()
    Thanks for the help, however it's not really working for me

    I did it in this sheet https://onedrive.live.com/redir?resi...nt=file%2cxlsx

    Can you tell me what i did wrong? maybe edit the mistake.

  4. #4
    Registered User
    Join Date
    01-13-2015
    Location
    Denmark
    MS-Off Ver
    2013
    Posts
    10

    Re: Return specific value IF specific text in cell

    Quote Originally Posted by Ace_XL View Post
    Key word seems to be 'contains' here

    =IF(ISNUMBER(FIND("abc",A2)),123,"")

    Remember FIND() is case-sensitive. You might want to use SEARCH()
    Thanks for the help, however it's not really working for me

    I did it in this sheet https://onedrive.live.com/redir?resi...nt=file%2cxlsx

    Can you tell me what i did wrong? maybe edit the mistake.

  5. #5
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Return specific value IF specific text in cell

    Its just an alternative solution

    =COUNTIF(A2,"*abc*")*123
    Appreciate the help? CLICK *

  6. #6
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Return specific value IF specific text in cell

    Its just an alternative solution

    =COUNTIF(A2,"*abc*")*123

  7. #7
    Registered User
    Join Date
    01-13-2015
    Location
    Denmark
    MS-Off Ver
    2013
    Posts
    10

    Re: Return specific value IF specific text in cell

    Quote Originally Posted by AZ-XL View Post
    Its just an alternative solution

    =COUNTIF(A2,"*abc*")*123
    Thank you! This worked.

    Now i would just like to add something onto it. I also want A1 to say 234 if A2 says BCD.

    How would those two functions look, next to each other?

  8. #8
    Registered User
    Join Date
    01-13-2015
    Location
    Denmark
    MS-Off Ver
    2013
    Posts
    10

    Re: Return specific value IF specific text in cell

    Quote Originally Posted by AZ-XL View Post
    Its just an alternative solution

    =COUNTIF(A2,"*abc*")*123
    Thank you! This worked.

    Now i would just like to add something onto it. I also want A1 to say 234 if A2 says BCD.

    How would those two functions look, next to each other?

  9. #9
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Return specific value IF specific text in cell

    =COUNTIF(A2,"*abc*")*123+COUNTIF(A2,"*bcd*")*234
    =IF(ISNUMBER(SEARCH("abc",A2)),123,IF(ISNUMBER(SEARCH("bcd",A2)),234,""))

+ 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. Look up several values in a cell and return a specific text
    By peterromer in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-27-2014, 12:03 PM
  2. Replies: 4
    Last Post: 08-15-2013, 09:50 AM
  3. [SOLVED] If a cell contains a specific text than return a value
    By dcdeez in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 06-04-2013, 08:31 AM
  4. Replies: 3
    Last Post: 06-20-2012, 07:16 AM
  5. Replies: 1
    Last Post: 06-05-2012, 02:22 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