I have a sheet that has a column (D) with values separated by a "-", I'm trying to split the value and get the second half and use that in a query to look up and fetch another value.
For example Sheet 1
Col D |
--------------|
67009-XYZ0001 |
Sheet 2
Col C | Col D | Col E |
------------|-------|----------|
XYZ0001.jpg | | test.com |
The formula should result in "test.com"
It works when used by it's self in a cell.
=query(Info!A:F,"Select E where C contains '"& index(SPLIT(D2,"-"),0,2) &"'")
Using it in an array formula without query the split and index works fine.
=ArrayFormula(IF(ROW(A:A)=1,"GET URL,index(SPLIT(D:D,"-"),0,2)))
But when I try using it in an array formula along with query it doesn't work.
=ArrayFormula(IF(ROW(A:A)=1,"GET URL",query(Info!A:F,"Select E where C contains '"& index(SPLIT(D:D,"-"),0,2) &"'")))
Is there any other way of achieving this.
Any help is appreciated. Thanks
I have shared the link to the spreadsheet
Sheet 1 shows the wrong result
Sheet 3 shows the desired result, but only works in cell.