Perry_M
Perry_M

Reputation: 27

How To Repeat Rows Based On a Value in a Column In Google Sheets

I would like to repeat data in cells from column B in column C if the value in Column A are "evc". With this code I end up with this

=TRANSPOSE(SPLIT(ArrayFormula(JOIN(" , ,",FILTER($B:$B, $A:$A = "evc"))),","))

Not Wanted

With this code I end up with this. I am new to Query commands and I don't know how to use the criteria.

=ARRAYFORMULA(TRIM(TRANSPOSE(SPLIT(QUERY(REPT(B1:B4&",", 2), ,999^99), ","))))

enter image description here

What I want instead is this. I think I need to use the repeat function but I can't figure out where to insert it.

Wanted

Upvotes: 0

Views: 576

Answers (1)

MattKing
MattKing

Reputation: 7773

This might work:

=ARRAYFORMULA(VLOOKUP(ROW(B:B),FILTER({ROW(B:B),B:B},A:A="evc"),2,TRUE))

It's not entirely clear what you want however, so try sharing more of a sample.

Upvotes: 2

Related Questions