Thanks for reading my question!
I have two different datasets, each in a different sheet, as below:
1st table: Sales data from survey (less correct):
Client | Yearly Sales |
---|---|
Apple | 10 |
20 | |
Nestle | 50 |
2nd table: Sales data from accounting (correct data):
Client | Yearly Sales |
---|---|
Apple | 11 |
20 | |
Mercedes | 30 |
Now, I have to make a summary report of these two. The rules are:
- Each client from both lists must be included (I have accomplished this already; Column "Client");
- I must include Yearly Sales; if the data from 2nd table is different from the 1st, the data in 2nd table is included;
- I'm trying to accomplish this in a spilled range ("Client" is a spilled range);
- There are unique client names in each table (they are all included in my summary report);
- I'm trying to accomplish this without VBA code.
The summary report must look like this:
Client | Yearly Sales |
---|---|
Apple | 11 |
20 | |
Mercedes | 30 |
Nestle | 50 |
Note: I've tried using XLOOKUP and SUMIFS combined with IF statement but I think I'm missing something important because my conditions are not working.
CodePudding user response:
Wrap you lookup in IFERROR. Search in your accounting data first, if it throws an error search in the survey data:
Example:
=IFERROR(VLOOKUP(G2:G5,D2:E4,2,0),VLOOKUP(G2:G5,A2:B4,2,0))
In this example:
D2:E4
= accounting data,
A2:B4
= survey data,
G2:G5
= unique names from both data sets.