+ Reply to Thread
Results 1 to 6 of 6

If cell contains this string then concatenate this else concatenate something else

  1. #1
    Registered User
    Join Date
    08-21-2003
    Posts
    45

    If cell contains this string then concatenate this else concatenate something else

    How would I use a concatenate function based on what string the cell contains?

    For example if cell AZ contains "car" then I want my concatenate to output "Type = Car".

    Else if cell AZ contains "truck" then I want my concatenate to output "Type = Truck".

    Else "Type = Other".

    Any example I find online always outputs the Else no matter what the cell value is, even when it should find the string.

    Here's what I have:
    =CONCATENATE("Type = ",IF(ISERR(FIND("car",AZ)),"Car",IF(ISERR(FIND("truck",AZ)),"Truck","Other")))

    cell value for AZ is d3truckdsds

    Any ideas?

  2. #2
    Registered User
    Join Date
    08-21-2003
    Posts
    45

    Re: If cell contains this string then concatenate this else concatenate something else

    I thought maybe I had ISERROR backwards where if it DOES NOT contain the string then...

    But this formula still returns "Other" as well:
    =CONCATENATE("Type = ",IF(ISERR(FIND("car",AZ)),IF(ISERR(FIND("truck",AZ)),"Other","Truck"),"Car"))

    Still using where cell value of AZ is d3truckdsds

  3. #3
    Registered User
    Join Date
    07-30-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    83

    Re: If cell contains this string then concatenate this else concatenate something else

    is AZ a named range, or a cell reference? If a named range, your formula should work fine...if a cell reference, then you need a row number.

    Edit: See Attached.
    Attached Files Attached Files
    Last edited by Yogi52o; 08-28-2014 at 05:11 PM.

  4. #4
    Registered User
    Join Date
    08-21-2003
    Posts
    45

    Re: If cell contains this string then concatenate this else concatenate something else

    Wow so close. Glad it was a simple fix. Thanks for catching the error.

  5. #5
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: If cell contains this string then concatenate this else concatenate something else

    Unless you've got a cell that you explicitly named "AZ", the FIND is always going to return a #NAME? error because AZ as such is not a valid cell reference.

    Is it supposed to refer to AZ1 instead or something?

  6. #6
    Registered User
    Join Date
    07-30-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    83

    Re: If cell contains this string then concatenate this else concatenate something else

    My pleasure. If that solves your problem, please mark the thread as [SOLVED], and I would appreciate the reputation.

+ 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. Replies: 8
    Last Post: 05-03-2014, 12:49 AM
  2. [SOLVED] VBA to concatenate a string, to a cell value in a range, to another string.
    By Sacharny in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-18-2013, 03:42 PM
  3. check string value inside cell and concatenate?
    By MacExcel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-23-2008, 07:31 PM
  4. Cell formula from concatenate string
    By sailingdan in forum Excel General
    Replies: 1
    Last Post: 11-06-2007, 05:28 PM
  5. how do i concatenate a string and cell formula and use a comma?
    By bob alou in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-24-2006, 11:35 AM

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