# Google Sheets: how to multiply two lists if condition applies in each row

I have a list of colors in column A (it could be A2:A)

A1 Colors Multiply
A2 Red 0
A3 Blue 1
A4 Orange 0

And I have types in column B (it could be as long as B2:B)

B1 Types
B2 Apple
B3 Banana
B4 Kiwi

now how can I make this list of Colors and multiply to Types just for those rows with Multiply column is 1

F G H
2 Red Red
3 Blue Apple Blue-Apple
4 Blue Banana Blue-Banana
5 Blue Kiwi Blue-Kiwi
6 Orange Orange

Given 'Colours' in A, 'Multiply' in B & 'Types' in C:

``````=arrayformula(lambda(
colours,
multiply,
types,
unique(flatten(colours&if(multiply,"-"&transpose(types),))))(
filter(A2:A,A2:A<>""),
filter(B2:B,B2:B<>""),
filter(C2:C,C2:C<>"")))
``````
• Thank you, with this formula, an extra row appears: "Blue-" =ARRAYFORMULA(UNIQUE(FLATTEN(A2:A&IF(B2:B,"-"&transpose(C2:C),)))) "Red", "Blue-Apple", "Blue-Banana", "Blue-Kiwi", "Blue-", "Orange" Commented Nov 28, 2022 at 21:25
• Got it, removed extra space in column, formula is correct Commented Nov 28, 2022 at 21:29