My data contains traffic source data from Google Analytics, grouped by customer. For each row, there is a TRANSPOSE(ARRAYFORMULA(
function that fills a horizontal array of values from another sheet. Any customers in the source sheet that have multiple rows with different values for traffic source will have an array of two or more values.
The formula I need is in column B. The formula I have so far is:
=ARRAYFORMULA(IF(D2:D="",C2:C,IF(COUNTIF($C:$Z,"Affiliate")>0,"Affiliate","-")))
The required output is an array that returns a value of source based on the condition set in the COUNTIF part of the formula. In this case I want "Affiliate" to be returned if it is present in the corresponding row. If it is not present, but "Referral" is present, return "Referral", otherwise return "-". Currently the formula returns "Affiliate" if it is present anywhere in the $C:$Z array, and is therefore not row-based.
Is there a way to change the array formula to search each row independently and return values based on the defined conditions?
Link to sample data with desired output
Edit: included link to sample data with required output. Also changed required output to include multiple values:
In this case I want "Affiliate" to be returned if it is present in the corresponding row. If it is not present, but "Referral" is present, return "Referral", otherwise return "-". Currently the formula returns "Affiliate" if it is present anywhere in the $C:$Z array, and is therefore not row-based.