+ Reply to Thread
Results 1 to 8 of 8

Concatenation after checking column contains any text or not

  1. #1
    Registered User
    Join Date
    12-20-2015
    Location
    Pakistan
    MS-Off Ver
    365
    Posts
    9

    Concatenation after checking column contains any text or not

    Hi Everyone!

    I have a query related to concatenating several columns.

    I have to make a product category path by concatenating categories from columns. each product is different and have different no. of categories, some has 1 category while others have 3, some have 4.

    It will come up like this: Health & Beauty > Health Care > Biometric Monitor Accessories > Blood Glucose Meter Accessories

    Above example there are 4 categories which are concatenate with ">".

    Now, I know the concatenation formula, BUT I can only apply once I have a check whether category has value or not..

    Looking forward to some guidelines in creating such formula.

    Thanks,

    Hamza

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Concatenation after checking column contains any text or not

    Try these
    =IF(A2="","",IF(B2="",A2,A2&">"&B2&IF(C2="",">"&C2,">"&C2&">"&D2)))
    where A2 as the 1st. category, B2 the 2nd., ... and D2 only exist if c2 exist, C2 only exist if B2 exist ...

    I hope this helps

  3. #3
    Registered User
    Join Date
    12-20-2015
    Location
    Pakistan
    MS-Off Ver
    365
    Posts
    9

    Re: Concatenation after checking column contains any text or not

    Thank you for your help, I am now trying to make it for all 7 categories I have but unable to do so, there are A2, B2, C2, D2, E2, F2 and G2. If you can kindly assist I would be grateful.

    Regards,

    Hamza

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

    Re: Concatenation after checking column contains any text or not

    Try

    =A2&SUBSTITUTE(B2,B2," > "&B2)&SUBSTITUTE(C2,C2," > "&C2)&SUBSTITUTE(D2,D2," > "&D2)&SUBSTITUTE(E2,E2," > "&E2)&SUBSTITUTE(F2,F2," > "&F2)&SUBSTITUTE(G2,G2," > "&G2)
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  5. #5
    Registered User
    Join Date
    12-20-2015
    Location
    Pakistan
    MS-Off Ver
    365
    Posts
    9

    Re: Concatenation after checking column contains any text or not

    Thank you for your help, I am now trying to make it for all 7 categories I have but unable to do so, there are A2, B2, C2, D2, E2, F2 and G2. If you can kindly assist I would be grateful.

    Regards,

    Hamza
    Quote Originally Posted by José Augusto View Post
    Try these
    =IF(A2="","",IF(B2="",A2,A2&">"&B2&IF(C2="",">"&C2,">"&C2&">"&D2)))
    where A2 as the 1st. category, B2 the 2nd., ... and D2 only exist if c2 exist, C2 only exist if B2 exist ...

    I hope this helps

  6. #6
    Registered User
    Join Date
    12-20-2015
    Location
    Pakistan
    MS-Off Ver
    365
    Posts
    9

    Re: Concatenation after checking column contains any text or not

    Thanks for your help but it is not allowing me to drag the formula to the last row.
    Quote Originally Posted by Ace_XL View Post
    Try

    =A2&SUBSTITUTE(B2,B2," > "&B2)&SUBSTITUTE(C2,C2," > "&C2)&SUBSTITUTE(D2,D2," > "&D2)&SUBSTITUTE(E2,E2," > "&E2)&SUBSTITUTE(F2,F2," > "&F2)&SUBSTITUTE(G2,G2," > "&G2)

  7. #7
    Registered User
    Join Date
    12-20-2015
    Location
    Pakistan
    MS-Off Ver
    365
    Posts
    9

    Re: Concatenation after checking column contains any text or not

    THANKS A LOT - It worked now as I tried to save it..
    Quote Originally Posted by Ace_XL View Post
    Try

    =A2&SUBSTITUTE(B2,B2," > "&B2)&SUBSTITUTE(C2,C2," > "&C2)&SUBSTITUTE(D2,D2," > "&D2)&SUBSTITUTE(E2,E2," > "&E2)&SUBSTITUTE(F2,F2," > "&F2)&SUBSTITUTE(G2,G2," > "&G2)

  8. #8
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Concatenation after checking column contains any text or not

    Quote Originally Posted by hamzabinnaeem View Post
    Thank you for your help, I am now trying to make it for all 7 categories I have but unable to do so, there are A2, B2, C2, D2, E2, F2 and G2. If you can kindly assist I would be grateful.

    Regards,

    Hamza
    Hi
    Use the following formula (systematized)
    =IF(A2="","",A2&IF(B2="","",">"&B2&IF(C2="","",">"&C2&IF(D2="","",">"&D2&IF(E2="","",">"&E2&IF(F2="","",">"&F2&IF(G2="","",">"&G2)))))))
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Regards

+ 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. Concatenation of numbers and text but only to display certain values?
    By alcorp in forum Access Tables & Databases
    Replies: 1
    Last Post: 08-19-2014, 08:20 PM
  2. Replies: 2
    Last Post: 10-30-2012, 12:58 PM
  3. Replies: 4
    Last Post: 09-05-2012, 01:50 PM
  4. needed selective concatenation, if text is present
    By batholith in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-18-2009, 04:31 PM
  5. Text data concatenation in Pivot?
    By VinceB in forum Excel General
    Replies: 0
    Last Post: 09-12-2006, 11:37 AM
  6. [SOLVED] Converting concatenation formula to text
    By FrigidDigit in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-20-2005, 05:05 AM
  7. date and text concatenation
    By littleps in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 07-28-2005, 07:05 AM

Tags for this Thread

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