-1

I have a database with references in column V. Some cells have single value, like 0001, others have several comma separated values, like 0001, 0002, 0003. I am trying to retrieve this data to a single column, but can not deal with transpose.

Here's the formula which working but not transposing data:

=ARRAYFORMULA(SPLIT(QUERY(ShotLISTbase!A:V, "SELECT V WHERE A = '"&ShotLIST_Print!J1&"' AND V is not null"), ", "))

This formula returns comma separated data in different columns:

enter image description here

I need to put all results in first column, transposing comma separated values.

Thank you in advance.

I've tried IF condition, but didn't achieve wanted result:

=ARRAYFORMULA(IFERROR(IF(SEARCH(",", QUERY(ShotLISTbase!A:V, "SELECT V WHERE A = '"&ShotLIST_Print!J1&"' AND V is not null"))>1,TRANSPOSE(SPLIT(QUERY(ShotLISTbase!A:V, "SELECT V WHERE A = '"&ShotLIST_Print!J1&"' AND V is not null"), ", "))),SPLIT(QUERY(ShotLISTbase!A:V, "SELECT V WHERE A = '"&ShotLIST_Print!J1&"' AND V is not null"), ", ")))
3
  • Can you include a sample input? I can only assume that your input is already in one column? The only problem is that some rows(in this case, cells since there is only one column) have multiple entries separated by commas. Did I understand your issue correcrly? Commented Oct 13, 2024 at 8:53
  • Have you tried using FLATTEN and then QUERY? =QUERY(FLATTEN(ARRAYFORMULA(SPLIT(<YOUR INPUT HERE>,","))),"SELECT Col1 WHERE Col1 IS NOT NULL") Commented Oct 13, 2024 at 9:14
  • @PatrickdC yes, I've started with FLATTEN then removed it, I didn't notice it influence result here. Commented Oct 13, 2024 at 18:34

1 Answer 1

2

Use tocol(), like this:

=tocol(filter(split(ShotLISTbase!V1:V, ", "), ShotLISTbase!A1:A = ShotLIST_Print!J1), 3)

See tocol().

Sign up to request clarification or add additional context in comments.

1 Comment

Great thank you! That is exactly what I was looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.