Frage

I have two pivot tables . I need to vlookup income values from table1 based on values that i have in table2. The goal is to populate column Q . The unique identifier of a row in both tables consists of team, state , person . Therefore in order to vlookup i use concatenate

enter image description here

Here is the formula that i use for the K column values =TRIM(CONCATENATE(TRIM(G2), TRIM(H2), TRIM(I2)))

Here is the formula that I use for the Q column values =VLOOKUP(TRIM(CONCATENATE(TRIM(M2), TRIM(N2),TRIM(O2))),$G$2:$K$40,4,FALSE)

It works fine only for totals . Why doesn't it work for other values ? How should I improve my formulas ?

War es hilfreich?

Lösung

As I mentioned in comments, you can use:

=INDEX($J$2:$J$40,MATCH(TRIM(M2) & TRIM(N2) & TRIM(O2),TRIM($G$2:$G$40) & TRIM($H$2:$H$40) & TRIM($I$2:$I$40),0))

This is an array formula, so type the formula then press CTRL+SHIFT+ENTER. Curly brackets will automatically appear at the start and end of the formula.

Or more elegant approach (similar to this post):

=LOOKUP(2,1/(TRIM($G$2:$G$40)=TRIM(M2))/(TRIM($H$2:$H$40)=TRIM(N2))/(TRIM($I$2:$I$40)=TRIM(O2)),$J$2:$J$40)

above formula is normal (not array) formula

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top