+ Reply to Thread
Results 1 to 11 of 11

Join Text with if conditions returning two different values

  1. #1
    Registered User
    Join Date
    11-19-2019
    Location
    Victoria, BC Canada
    MS-Off Ver
    Office 365 Office 2016
    Posts
    8

    Join Text with if conditions returning two different values

    Basically I'm joining text but using and concatenate LEFT with it but including a cell that may be blank or not blank but it's not working correctly if the cell is blank
    =IF(ISBLANK(G3),UPPER(CONCATENATE(LEFT($F3,1),LEFT($H3,7))),UPPER(CONCATENATE(LEFT($H3,1),$G3,LEFT($F3,6))))

    If tried =IF(ISBLANK(G3),UPPER(CONCATENATE(LEFT($H3,1),LEFT($F3,7))),(IF(ISTEXT(G3),UPPER(CONCATENATE(LEFT($H3,1),$G3,LEFT($F4,6))))
    =IF(ISTEXT(G3),UPPER(CONCATENATE(LEFT($H3,2),$G3,LEFT($F3,5))),UPPER(CONCATENATE(LEFT($H3,1),LEFT($F3,7))))

    Think lastname, first name middle initial - but when I'm wanting to join it to make a username of 8 characters total but use middle initial if there is one but still get 8 characters if there isn't a middle initial. I end up with 7 characters only if no middle initial.
    I've tried hidden columns and tried to use if statement for true or false but I'm always ending up with 7 characters when no middle initial K and L have the correct value but still results only 7
    =IF(ISBLANK(G3),L3,K3)
    =IF(ISBLANK(G3),L3),(IF(ISTEXT(G2),K3))
    but doesn't return the value of L3 which is correct for the 8 characters it only gives me 7 yet the formula in that cell gives me the correct but it then gives me only 7.. uuurrrr


    but still end up with 7 characters when there is no middle initial uuurrrggggg

    I've tried the new TEXTJOIN and CONCAT get same results. I know there is a way to do this, I'm just drawing a blank at this moment.

    Driving me crazy.

  2. #2
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,465

    Re: Join Text with if conditions returning two different values

    Can you give us a few samples of data you may have and show us what you want from it?

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,673

    Re: Join Text with if conditions returning two different values

    Please update your forum profile - TEXTJOIN and CONCAT are in Excel 2019 and later - which do you have?

    Please provude a sample workbook with several rows of data showing all eventualities and the outcomes you expect.

    There are inconsistencies in your formulae. What is the logic for the concatenation?
    Last edited by AliGW; 06-30-2023 at 12:51 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    11-19-2019
    Location
    Victoria, BC Canada
    MS-Off Ver
    Office 365 Office 2016
    Posts
    8

    Re: Join Text with if conditions returning two different values

    Office 365 Excel 2016 version
    If there is no middle initial I'm always short characters when I want 8 characters.
    Example.JPG

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,938

    Re: Join Text with if conditions returning two different values

    Try the following in cells I2 and down: =IF(G2="",UPPER(CONCATENATE(LEFT($F2,1),LEFT($H2,7))),UPPER(CONCATENATE(LEFT($H2,1),$G2,LEFT($F2,6))))
    If that doesn't work then please utilize the information in the "HOW TO ATTACH YOUR SAMPLE WORKBOOK" banner at the top of the page to attach the Excel file from which the screenshot in post #4 is taken.
    Let us know if you have any questions.
    Last edited by JeteMc; 07-02-2023 at 09:24 PM. Reason: Added formula
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  6. #6
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,198

    Re: Join Text with if conditions returning two different values

    Office 365 Excel 2016 version
    These are 2 different versions. Which is it.

    You don't really need CONCATENATE. Try this:

    =IF(G2="",UPPER(LEFT($H2,1)&LEFT($F2,7)),UPPER(LEFT($H2,1)&$G2&LEFT($F2,6)))

    You don't say what you want to have happen if the last name is less than 7 characters, but I assume you have that handled

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,673

    Re: Join Text with if conditions returning two different values

    Office 365 Excel 2016 version
    You haven't updated your profile - please change it to Office 365. Thanks.

    I asked for a sample workbook, NOT a picture! Please attach a workbook.

  8. #8
    Registered User
    Join Date
    11-19-2019
    Location
    Victoria, BC Canada
    MS-Off Ver
    Office 365 Office 2016
    Posts
    8

    Re: Join Text with if conditions returning two different values

    Thank you JeteMc that did the trick. All good now :-)

  9. #9
    Registered User
    Join Date
    11-19-2019
    Location
    Victoria, BC Canada
    MS-Off Ver
    Office 365 Office 2016
    Posts
    8

    Re: Join Text with if conditions returning two different values

    Thank you that worked

    Going across the columns. Worked perfectly. Thank you!!!!

    =IF(G3="",UPPER(CONCATENATE(LEFT($H3,2),LEFT($F3,6))),UPPER(CONCATENATE(LEFT($H3,1),$G3,LEFT($F3,6))))

    =IF(G3="",UPPER(CONCATENATE(LEFT($H3,3),LEFT($F3,5))),UPPER(CONCATENATE(LEFT($H3,2),$G3,LEFT($F3,5))))

    =IF(G3="",UPPER(CONCATENATE(LEFT($H3,4),LEFT($F3,4))),UPPER(CONCATENATE(LEFT($H3,4),$G3,LEFT($F3,3))))

    =IF(G3="",UPPER(CONCATENATE(LEFT($H3,5),LEFT($F3,3))),UPPER(CONCATENATE(LEFT($H3,5),$G3,LEFT($F3,2))))
    Last edited by Masks44; 07-03-2023 at 04:00 PM.

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,938

    Re: Join Text with if conditions returning two different values

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,673

    Re: Join Text with if conditions returning two different values

    @Masks44

    Please update your forum profile as requested earlier. Thanks.

+ 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. Text Join Unique Values
    By tahntahn03 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-03-2023, 11:02 PM
  2. [SOLVED] LOOKUP with Criteria returning multiple values with TEXT JOIN
    By dluhut in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-17-2022, 07:35 PM
  3. [SOLVED] XLookup returning wrong values when using two conditions
    By Einrastor in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-03-2020, 07:38 AM
  4. Replies: 2
    Last Post: 11-30-2019, 11:19 AM
  5. [SOLVED] Array Formula - Returning text value if two conditions are met
    By lostest in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-28-2015, 06:11 PM
  6. Returning row if conditions met (text)
    By pauldaddyadams in forum Excel General
    Replies: 7
    Last Post: 05-21-2015, 03:32 AM
  7. Returning Values of Different Cells Depending on Conditions
    By laffers in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-19-2010, 10:19 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