Excel multi column lookup - excel

I am unsure how to Google this one. I have a table that looks like the below
Last Name | First Name | Team A | Team B | Team C
Smith | John | X | |
Doe | Jane | | X |
This would be the main sheet. The names in this sheet are divided into other sheet depending on what department they are in. Those sheets are setup in the same formats with the same columns. If the people in the main sheet are marked with an X in one of the columns I would like that same column marked in marked in the department sheets.

Your best bet might be to create a hidden column A where the value is a combination of column B and column C on all of your tabs. You could then use the standard VLOOKUP wrapped in an IFERROR clause.
For example,
=IFERROR(VLOOKUP(A1,Sheet1!A:F,3,False),"")
The IFERROR handles the instance that you may have a name on a sub tab not on the main tab. It returns blank instead of #N/A. The VLOOKUP is checking the value in A1 to what is in A1 on your main tab. A1 would be the combination of First and Last. The VLOOKUP would need to be in each of your team columns shifting the column returned number in each VLOOKUP.

Related

Extracting all information(different) with same row name form a excel worksheet using formula

I have a excel workheet having a table with multiple rows having same name with different information in the corresponding columns. Now using a formula I want to extract this infomation into a new table? SOLUTION HAS TO BE USING AN EXCEL FOMULA ? NO FILTERS NO PIVOT TABLE OR VBA
I have tried vlookup. to search for multiple values. I dont want information from a single column but rather from all the columns. There could be thousands of columns with same and different values.
I have tried this formula : =INDEX(Worksheet!A2:AK350;KKLEINSTE(WENN((A5=Worksheet!A2:A350);VERGLEICH(ZEILE(Worksheet!A2:A350);ZEILE(Worksheet!A2:A350));"");1))
The table looks like this for example:
Place People Salary Status
japan | resident_1 | 564 | un-married
Delhi | resident_1 | 655 | un-married
china | resident_1 | 564 | un-married
japan | resident_2 | 748 | un-married
Now I want to extract a sub table from the above, like all the
infomation having PLACE name as "japan"
the reult should be this for each place in a different table:
japan | resident_1 | 564 | un-married
japan | resident_2 | 748 | un-married
Seems like a job for advanced filter, but you've already stipulated "no filters". If you're able to add two helper columns in your main table, maybe you can use the approach below.
This is my main_table worksheet (note the columns outlined in red, which have been added).
The formula in column E (starting from cell E2) is: =CONCAT(A2,"|",B2,"|",C2,"|",D2)
The formula in column F (starting from cell F2) is: =ROW()-ROW($F$2)+1
Drag/fill these formulas down to the last row in your main table.
This is my sub_table worksheet (note the cells outlined in green at the top, where you will eventually specify filter criteria).
The formula in column A (starting from cell A5) is: =ROW()-ROW($A$5)+1
The formula in column B (starting from cell B5) is: =IFERROR(SMALL(IF(ISNUMBER(SEARCH($B$2,main_table!$E$2:$E$10)),main_table!$F$2:$F$10,""),$A5),"")
The formula in columns C, D, E, F (starting from cell C5) is: =IF(ISNUMBER($B5),INDEX(main_table!$A$2:$D$10,$B5,COLUMNS($C5:C5)),"")
The formula in cell B2 is: =CONCAT(IF(ISBLANK($C$2),"*",$C$2),"|",IF(ISBLANK($D$2),"*",$D$2),"|",IF(ISBLANK($E$2),"*",$E$2),"|",IF(ISBLANK($F$2),"*",$F$2))
You should drag the formula down for the same number of rows that are in your main table.
I think newer/upcoming versions of Excel have a JOIN worksheet function which is more convenient/flexible than my usage of CONCAT above (so maybe use that if it's available to you).
Leaving the filter criteria blank should give you all rows. If you want partial matches, include wildcards in your input e.g. jap* or resident_*. If any of the values in your main table contain a |, you may want to use a different delimiter in the CONCAT formulas (otherwise you may get unexpected results/behaviour).
Once you're done, maybe you can use it like shown below:
See if this approach is any good for you (you will probably need to translate the formulas to your locale/region).

Excel Formula - Return unique count of range based on multiple criteria from different tables

I have three tables: Parties, Document Detail and Document. (Note, they are not table formatted, so all references are based on cell and sheet location, not table aliases)
I want to return a unique count of the parties in each Document using an Excel Formula. My problem is, I would usually use a =COUNTIFS() formula for this, which would be something like the following, which I would put in B2 of Sheet 3 (Document table):
=COUNTIFS(Sheet2!A:A,A2,Sheet2!B:B,Sheet1!A2)
But this will only return the count of one criteria at a time, not a count checking for all values of the parties table per document. I understand it should be able to be done with an array formula, but I can't figure it out. Bonus points if someone can figure out how to do it with a non-array formula!
Sheet1 - Parties Table
A
1|Parties |
+-----------------+
2|Education Officer|
3|Elder |
4|Family Support |
5|Interpreter |
Sheet2 - Document Detail Table
A B
1 |Doc ID | Party |
+-------+-----------------+
2 |FID0001|Education Officer|
3 |FID0001|Elder |
4 |FID0001|Education Officer|
5 |FID0001| |
6 |FID0001| |
7 |FID0002|Elder |
8 |FID0002|Interpreter |
9 |FID0002|Family Support |
10|FID0002| |
Sheet3 - (Desired Result) - Document Table
A B
1|Doc ID |Party Count|
+-------+-----------+
2|FID0001| 2 |
3|FID0002| 3 |
TL:DR
What combination of Excel formulas can I use to return the number of unique parties referenced in each document?
Based on this answer by Barry Houdini and expanded to include the DocID criteria
Put a helper column on Sheet2, lets say in colum C
=IFERROR(1/COUNTIFS($B:$B,$B:$B,$A:$A,$A:$A),0)
and copy down for all data rows
Then, in Sheet3 Party Count Formula is
=SUMIFS(Sheet2!$C:$C,Sheet2!$A:$A,$A:$A)
The non-Implicit Intersection versions
Sheet2 cell C1
=IFERROR(1/COUNTIFS($B:$B,$B1,$A:$A,$A1),0)
Sheet3 cell B2
=SUMIFS(Sheet2!$C:$C,Sheet2!$A:$A,$A2)

Excel IF Formula 3

I have a sheet with rows of data that I want to copy to a different sheet if the name in column a equals a certain value. For example:
A | B | C
Name | Color | Amount
Sue | Blue | $400
Joe | Green | $1000
Sheet Sue needs to bring columns B and C from Sue's records to it's worksheet if column a equals Sue
Sheet Joe needs to bring columns B and C from Joe's records to it's worksheet if column a equals Joe
and so on and so forth...
Can anyone help!?
Well, if you don't have too much data you can do this with array formulas.
Set up your main sheet (assuming it's Sheet1) with named ranges. Your A2:A100 name it Name, B2:B100, name it Color, and C2:C100 name it Amount. (Adjust the range as necessary)
Then, in each of the people's sheets, have header rows called Name, Color, and Amount. Then you can use this formula (entered with CTRL+SHIFT+ENTER):
=INDEX(INDIRECT(A$1),SMALL(IF(INDIRECT($A$1)=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255),ROW(INDIRECT($A$1))-ROW(Sheet1!A$2)+1),ROWS(Sheet1!$A$2:A2)))
Wrap IFERROR([formula],"") to hide the #NUM errors when you reach the end of the data.

Excel: Create Custom Sheet 2 Based on Data in Sheet 1

I have two sheets in a spreadsheet. Each sheet has a first column with common values (however they are not sorted the same and they are not all there in each sheet).
What I'm trying to do, if possible, is put a formula in sheet 2, where, if column 1 is a match for sheet 1, copies selective data from certain columns in that same row in sheet 1, to certain columns in sheet 2.
Example:
Sheet 1 has a heading setup and sample data row like this:
Title | Day of Week | First | Last
Supervisor | Wednesday | Mike | Jones
Sheet 2 has a heading setup and sample data row like this:
Title | Surname | Weekday
Supervisor | (empty cell) | (empty cell)
After running the mystery formula I'm looking for, placed in the 2 empty cells above, sheet 2 should match on the Supervisor key in sheet 1 and copy in data I have specified into each column, such as:
Title | Surname | Weekday
Supervisor | Jones | Wednesday
(In this case I have told it to map the "day of week" column to weekday, and map the "last" column to "surname").
I hope this is easy/possible??? Help???
VBA is not necessary. You can use a simple VLOOKUP:
=VLOOKUP(cell to look-up,
range where you want to look up the values (first column *must* contain the keys to look-up) including all columns that you want to retrieve,
the position of the column to be retrieved relative to the first column specified in argument 2,
0 (specifies you want an exact match))
For example:
=VLOOKUP(A1, Sheet1!$A$1:$D$150, 2, 0) ' Retrieves the 2nd column matching criteria in A1
Please notice, however, that you need your keys to be unique. Matching information based on the title seems a bit odd since it is likely there will be more than one person assigned to a certain role. For example, there may be more than 1 supervisor.
Use INDEX and MATCH (better than VLOOKUP).
I suggest renaming your headers so they match on both sheet.
Sheet 1 should be :
Title | Weekday | First Name | Surname
In sheet 2, cell B2 type in
=INDEX(Sheet1!$A:$D,match($A2,Sheet1!$A:$A,0),match(B$2,Sheet1!$1:$1,0))
You can drag and drop it in column C as well, it will work since you are using two MATCH functions with the cells properly anchored.

Find two matching rows and display data from the thirt one (Excel)

So i have Two Sheets.
First sheet contains two columns
BRAND | LEFTOVER
The second sheet consists of two columns also.
BRAND | LEFTOVER (%)
So in case if the BRAND row value in the first Sheet will match the BRAND row value in the second i want to display the matching LEFTOVER (%) row value in the first sheet rows in the column LEFTOVER.
Kind of lost here.
Appreciate any ideas. Thanks.
In Sheet2:
. A | B
--------------------
1 BRAND | LEFTOVER %
2 X | Y
3 |
In Sheet1:
. A | B
--------------------
1 BRAND | LEFTOVER
2 X | =VLOOKUP(A2,Sheet2!A:B,2)
3 |
The VLookup function searches for its first parameter (in this case the value of Sheet1!A2) in the first column of the range denoted by the second parameter (in this case the leftmost column of the range containing columns A and B on Sheet2)
It then returns the value from that same row of the range that is to the right in the columns denoted by the third parameter (1 is the leftmost column where the matched value was). So in this case we use the number 2 because 1 means column A and 2 is column B (which explains why we used a two column wide range for the second parameter - it needed to encompass the column the result was in)
This isn't the only way to do this, but it is the easiest.
As Jerry stated VLOOKUP is the simplest way to do this.
HOWEVER if you have multiple/repeat instances (rows) in BRAND, VLOOKUP will only return the first record (row) that appears in your data.
If this is the case, you will need to add either a unique identifier column; and/or additional criteria to differentiate between the repeat instances.
As an example column A is used as a unique identifier to differentiate between the 2 'Nike' rows.
A B C
1 BRAND LEFTOVER
2 Nike 50
3 Adidas 25
4 Reebok 30
5 Nike 29
I feel that you can use vlookup to accomplish your goals.
Let me explain it in a bit detail.Suppose you have two sheets as:
A | B | A | B
--------------------- | -------------------
1 BRAND | LEFTOVER % | 1 BRAND | LEFTOVER
2 X | Y | 2 X | =Vlookup(A2,Sheet2!A:B,False)
3 | | 3 |
Sheet2 | Sheet1
After this you can drag this formula for the entire range. This will automatically make the formula correct for the below cells as well.
Also, if you need to populate any other fields from the Sheet2 then you can also use the vlookup as an array formula like: VLOOKUP(A2,Sheet2!A:B,{1,2,3,4},FALSE)
Enter this as an array formula using Crtl+Shift+Enter
Here {1,2,3,4} stands for the columns to be fetched.
If you want to know more about vlookup then read this article: http://www.exceltrick.com/formulas_macros/vlookup-in-excel

Resources