Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Custom Function to Cross-Joining

$
0
0

I am looking for a flexible custom function to be able to cross-join (cartesian product) 2 columns of varying lengths in Google Sheets.

My research so far has led me to ask because:

  1. using a combination of existing formulas in Sheets either produces some weird artifacts (counting blank cells as values to cross-join) or has limits to how many results it can produce.
  2. The JavaScript solutions online pertain to specific examples and have not worked for my case yet (I have very limited knowledge of JavaScript).

To further describe my request:

  1. It must be able to cross-join 2 columns of ANY length (if one column is longer than the other, I don't want it to utilize blank cells from the shorter one).
  2. I would love it to be flexible in that I can place it anywhere and use any combination of columns

Edit 1:
Sorry for any missing information, it's my first time posting here

So I'm not sure how many formulas I have tried but it's been over 20, I'm not sure how productive it would be to post those in here because I'm looking for JavaScript at this point.

Here's an example of some data sets and results I would like to get from this one script:

A small data set example, preferable would be able to done with 100 rows. I also would like to be able to have 1 column have 100 rows and one have 2 or whatever combo.

I've seen many scripts be dependent on the header name and stuff and I would like that not to be the case.


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>