Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88835

Generate an array of 0 and 1 with given conditions

$
0
0

How does one generate an array according to value in cells? For example, if (A1,B1) is (3,0), (A2,B2) is (2,1), and (A3,B3) is (2,0) (this first number depicts how many of the second number in the array), how does one obtain an array of {0,0,0,1,1,0,0}? In a general form, if I have (i,0), (j,1), and (k,0), I would like to get an array of {i zeros,j ones, k zeros}.

Several Excel functions can return an array, such as OFFSET, INDEX. I don't know any way to concatenate arrays.

Any way to do this?


Viewing all articles
Browse latest Browse all 88835

Trending Articles



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