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

Get the first non-blank column value in each row a range using arrayformula or similar

$
0
0

I'm attempting to create an ARRAYFORMULA that can extract the first non-blank COLUMN value on each row in a range.

My latest attempt is this:

=TRANSPOSE(QUERY(TRANSPOSE( A2:D6),"select * where Col1 <>'' limit 1",9^99))

Placed in F2, this generates all the output of the range F2:F6 in the table below.

However it's quite evident that all it does it to concatenate all the cells in each column using a space as a delimiter, so the output does not resemble my expected outcome, shown in H2:H6 :-(

I've come up with several other formulas, but the all exhibit the same problem. :-(

┌───────┬───────┬───────┬───────┬───────┬───┬────────────────┬───┬──────────┐
│       │   A   │   B   │   C   │   D   │ E │       F        │ G │    H     │
├───────┼───────┼───────┼───────┼───────┼───┼────────────────┼───┼──────────┤
│   1   │ Input │ Input │ Input │ Input │   │ Formula/Output │   │ Expected │
├───────┼───────┼───────┼───────┼───────┼───┼────────────────┼───┼──────────┤
│   2   │ Test0 │       │ Test1 │       │   │Test0 Test1     │   │ Test0    │
├───────┼───────┼───────┼───────┼───────┼───┼────────────────┼───┼──────────┤
│   3   │       │       │       │       │   │                │   │          │
├───────┼───────┼───────┼───────┼───────┼───┼────────────────┼───┼──────────┤
│   4   │       │       │       │ Test3 │   │   Test3        │   │ Test3    │
├───────┼───────┼───────┼───────┼───────┼───┼────────────────┼───┼──────────┤
│   5   │       │   5   │       │       │   │ 5              │   │ 5        │
├───────┼───────┼───────┼───────┼───────┼───┼────────────────┼───┼──────────┤
│   6   │       │       │54:74=2│       │   │  54:74=2       │   │ 54:74=2  │
└───────┴───────┴───────┴───────┴───────┴───┴────────────────┴───┴──────────┘

So my question is, how can I make an arrayformula or query that I can place in F2 will only select the first non-blank value in each column in F2:D6, and output the result to F2:F6?


Viewing all articles
Browse latest Browse all 9626

Trending Articles



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