+ Reply to Thread
Results 1 to 2 of 2

Formula to combine All elements in 1 Row

  1. #1
    Registered User
    Join Date
    01-20-2017
    Location
    Berlin
    MS-Off Ver
    Business
    Posts
    12

    Formula to combine All elements in 1 Row

    hey guys,

    I have a problem with combining different cells from 1 row. There's no need to create ALL possible combinations per row (reversed like: keyword1a & keyword1b + keyword1b & keyword1a) --> Just 1 of the 2 combinations is enough.

    Is there a proper way to do this with a formula?

    Basically this is what I need.



    Input
    keyword 1a keyword 1b keyword 1c keyword 1d
    keyword 2a keyword 2b keyword 2c keyword 2d


    Output
    keyword 1a keyword 1b
    keyword 1a keyword 1c
    keyword 1a keyword 1d
    keyword 1b keyword 1c
    keyword 1b keyword 1d
    keyword 1c keyword 1d

    keyword 2a keyword 2b
    keyword 2a keyword 2c
    keyword 2a keyword 2d
    keyword 2b keyword 2c
    keyword 2b keyword 2d
    keyword 2c keyword 2d


    Thanks a lot!

  2. #2
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Formula to combine All elements in 1 Row

    It's a bit of an ugly approach, but if your input is X rows with 4 keywords, then I think you can do the following:

    With your input in E2:H3, enter the following in A2 and fill down:

    =IFERROR(INDEX($E$2:$H$3,CEILING(ROW(1:1)/6,1),MAX(ROUNDDOWN((MOD((ROW(1:1)-1),6)+1)/2,1),1)),"")

    Then enter the following in B2 and fill down:

    =IFERROR(INDEX($E$2:$H$3,CEILING(ROW(1:1)/6,1),IF((MOD((ROW(1:1)-1),6)+1)>3,CEILING((MOD((ROW(1:1)-1),6)+1)/2,1)+1,(MOD((ROW(1:1)-1),6)+1)+1)),"")

    The resulting pairs in columns A and B should match what you're looking for. If you have more than two rows of input keywords, just put them in E4:H? and change the first part of each formula to $E$2:$H$4 or whatever is necessary to incorporate the new input rows. If an input row requires more or less than 4 keywords... then this formula won't work. It's pure pattern creation, there's no actual permutation work being done. Hopefully that's good enough? Take a look at the attachment to see how it looks.
    Attached Files Attached Files

+ 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. How to combine all elements in 1 Row
    By david_cc in forum Excel General
    Replies: 1
    Last Post: 01-20-2017, 02:09 PM
  2. Replies: 5
    Last Post: 06-12-2015, 07:02 PM
  3. [SOLVED] Removing specific elements from an Array based on matching elements in a different Array
    By jamesdeuce in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-24-2014, 10:35 PM
  4. [SOLVED] Looping to combine rows based on two elements
    By thesteve in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-16-2014, 02:04 PM
  5. Resources for Using VBA to Manipulate Silverlight Elements like HTML Elements
    By linear_db in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-16-2013, 04:43 PM
  6. Moving Time Elements Into Formula
    By rickmcq in forum Excel General
    Replies: 2
    Last Post: 02-17-2012, 08:23 AM
  7. can't combine VBA elements
    By cdn.mark in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2011, 04:16 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