Reputation: 329
I need to create a QUERY
function to retrieve values from different columns, based on the following 2 criteria:
If the value in column A is "Company name changed", I need columns B and C. And if the value in column A is "Email changed", I need to retrieve the corresponding values to that record from columns B, C, D and E. All of the above in the same table.
Please, excuse me for not sharing a dummy sheet, but I have corporate security restriction, which is not allowing me to make any sheet visible to anyone outside the company.
Source tab:
+----------------------+------+-------------+--------------------------+----------------------------+
| A | B | C | D | E |
+----------------------+------+-------------+--------------------------+----------------------------+
| Status | ID | Company | Email | Generic Email |
+----------------------+------+-------------+--------------------------+----------------------------+
| Email changed | 223A | ABC Capital | [email protected] | [email protected] |
+----------------------+------+-------------+--------------------------+----------------------------+
| In progress | 446g | DEF Finance | [email protected] | [email protected] |
+----------------------+------+-------------+--------------------------+----------------------------+
| Company name changed | 233A | GHI Dealing | [email protected] | [email protected] |
+----------------------+------+-------------+--------------------------+----------------------------+
| Dissolved | 334s | JKL Brokers | [email protected] | [email protected] |
+----------------------+------+-------------+--------------------------+----------------------------+
Output tab:
+------+-------------+-----------------------+---------------------+
| ID | Company | Email | Generic Email |
+------+-------------+-----------------------+---------------------+
| 223A | ABC Capital | [email protected] | [email protected] |
+------+-------------+-----------------------+---------------------+
| 233A | GHI Dealing | | |
+------+-------------+-----------------------+---------------------+
What could be the possible workaround for this?
Upvotes: 1
Views: 183
Reputation: 1
={QUERY(A1:E, "select B, C, D, E
where A = 'Email changed'", 1);
QUERY(A2:E, "select B, C, ' ', ' '
where A = 'Company name changed'
label ' ''', ' '''", 0)}
Upvotes: 1