+ Reply to Thread
Results 1 to 8 of 8

formula to generate a string

  1. #1
    Registered User
    Join Date
    08-08-2019
    Location
    the Netherlands
    MS-Off Ver
    Office 2016
    Posts
    4

    formula to generate a string

    Hi,

    I am trying to build a relationship table from a flat table and should look something like this. The number in column A is considered a parent product and the relations in the result column should be the other products which have the same group values.

    It should look like this:

    A B C
    Number Group result
    1223 110001 1224
    1224 110001
    1225 100502 1226 | 1227
    1226 100502
    1227 100502
    1228 110720 1229 | 1230 | 1231
    1229 110720
    1230 110720
    1231 110720

    The column result obviously needs to be populated with a formula, but I cannot seem to figure out what the formula should be.
    I have tried a countif(B:B,B1) formula and copy that down. That allows me to filter out all single occurences.
    Then I wanted to work with an if formula to test if B2 is different from B1. If not, then I need to concatenate the value in column A with something. As I said, I can't seem to figure out how to dow this.

    I hope somebody can help me.

    Thank you in advance.
    Last edited by lightframe109; 08-08-2019 at 10:26 AM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,079

    Re: formula to generate a string

    The end result is a concatenation of data.
    If you are working with limited rows of data then you could build up such a result but if there will be lots or an unknown quantity of data to concatenate then this would only be possible using TEXTJOIN (if you have it), otherwise VBA would be your only recourse.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    08-08-2019
    Location
    the Netherlands
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: formula to generate a string

    Hi Special-K,

    It's not an awfull lot of data. A little over 1800 records, but enough to want to have an outomated solution .
    Unfortunately I don't have Textjoin at the moment, but I will have a look into this.

    Thank you.

  4. #4
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,883
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  5. #5
    Registered User
    Join Date
    08-08-2019
    Location
    the Netherlands
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: formula to generate a string

    Awesome. I will give that a try tomorrow.
    Judging from the reddit link, It say textjoin should be available in office 2016. I can't remember having seen it earlier when I was at work.
    I will have a look at it tomorrow.

    Thank you.

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: formula to generate a string

    TEXTJOIN is only available if you have an Office 365 subscription.

    You can use Power Query for this.

    Although this isn't the exact result that you're after, I suspect this may be helpful if not ideal.

    1) Highlight the data > Data > From Table > OK
    2) Group By > Group > New column name: Temp > Operation: All Rows > OK
    3) Add Column > Custom Column > =Table.Column([Temp],"Number") > OK
    4) Delete the Temp column
    5) Click on the button next to the Custom header > Extract Values > Custom: | > OK
    6) Home > Close & Load

    See attachment.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-08-2019
    Location
    the Netherlands
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: formula to generate a string

    Hi,

    Awesome. This is basically what I am looking for. At least it beats going through all the records by hand.
    Thank you so much.

    Kind regards,
    lightframe109

  8. #8
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: formula to generate a string

    You're welcome. Happy to help.

    The cool part about Power Query is that once it is built, all that you have to do if you get more data in the future is add it to the bottom of the blue table then refresh the green table.

+ 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] Generate random values between two number and specific string
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-28-2016, 04:15 PM
  2. [SOLVED] Generate a string of numbers according to number of days in the month
    By bqheng in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-04-2016, 03:30 AM
  3. [SOLVED] Auto generate number with text string
    By hkbhansali in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-31-2015, 09:54 AM
  4. Extracting Number from Dates to generate a string of numbers...
    By Adam_S in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-23-2014, 04:48 AM
  5. Button to Generate Random String of Numbers
    By dlenoxx in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-26-2009, 06:37 PM
  6. Replies: 7
    Last Post: 09-01-2007, 04:29 PM
  7. [SOLVED] Generate Text String
    By Joe S. in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-03-2005, 12:06 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