If found in Column A, display entire row - excel

I am trying to do a lookup but VLOOKUP does not seem to be the answer...maybe an INDEX and MATCH formula but I can't wrap my head around it.
Anyway, I have two tabs, one with data, and the other one will pull parts of the data from the first tab. In tab one my columns look like this (Google Sheets):
TAB 1 A B C D E
ROW 1 - PRODUCT DATE GARY TOM MARY
ROW 2 - Apples 9/1/2014 45 22 37
ROW 3 - Pears 9/1/2014 15 12 17
ROW 4 - Oranges 9/1/2014 18 27 61
ROW 5 - Figs 9/1/2014 4 2 7
ROW 6 - Apples 8/1/2014 35 21 31
ROW 7 - Pears 8/1/2014 19 7 11
ROW 8 - Oranges 8/1/2014 48 41 31
ROW 9 - Figs 8/1/2014 16 7 17
In TAB 2, I have the same Columns of Product, Date, Gary, Tom, Mary, but I would like to group their info by product and date. For example, TAB 2 would pull all data that matched Apples and display the entire row. So Tab 2 WOULD give these results:
TAB 2 A B C D E
ROW 1 - PRODUCT DATE GARY TOM MARY
ROW 2 - Apples 9/1/2014 45 22 37
ROW 3 - Apples 8/1/2014 35 21 31
I would then repeat this for Tab 3 which would pull data for Pears, tab 4 for Oranges, and so on. Of course we will be adding data to this each month so the formula in tab 2 will need to reflect new additions.
Thoughts?

1) in TAB 2 go to cell A1. right click, and then click data validation.
set up the box as shown below.
2) in cells B1:E1 put DATE GARY TOM MARY respectively
3)in cell A2 write the following formula: =filter('TAB 1'!A:E,'TAB 1'!A:A=A1)
4)choose your fruit from the dropdown box.
5)it might be worht formatting A1 with a yellow fill or something...

This is not going to be possible using standard Excel formulas. To accomplish what you wish I would recommend using several Pivot Tables.
Step 1
Start by selecting the data and navigating to Insert -> Pivot Table in the menu (depending on the version of Excel you are using, the Create PivotTable dialog may differ slightly).
Step 2
Select the PRODUCT column for your filter, the DATE column for your row groups, and the sums of GARY, TOM, and MARY for your values. Set the filter value to Apples (or whichever product you wish to display on this worksheet).
Step 3
Make any desired cosmetic changes to the PivotTable, and then repeat for each worksheet.
Notes
The PivotTable will not update automatically. If you intend to continue to add rows to your first worksheet, I would recommend setting the Table/Range (in step 1) to something like Sheet1!$A$1:$E$1000. Then, when an edit is made you can click the Refresh button in the menu to refresh the data.
If you don't want to have to refresh all tables manually, you can build a macro that will do so automatically.

I suggest using PivotTables, as opposed to formulas. You can name the data range you use which can be large enough to accommodate future entries and create a PivotTable on each tab quite easily - select the data or named range and do Insert -> PivotTable. Then, within the PivotTable Field List, use the "Choose fields to add to report:" filters and select the specific product you want for a given tab. This would work best if there are only a few handfuls of items as managing 100's of different products or product types may become tedious.
By using a large enough range, you can add data to the set and/or range and use the "Refresh All" button under the 'Data' tab to update the workbook.
Chandoo.org provides some great resources for PivotTable use. Also, when I first started I was fond of fiveminutelessons.com. To be honest, a quick Google search should turn up some decent help topics

Related

Create filter for a drop down list that groups several rows together

I have the following table:
A
B
C
1
Team
2
Team1
Working hours
10
3
Name
Ronald
4
Team2
Working hours
20
5
Name
Magda
6
Team1
Working hours
30
7
Name
John
Column (A2:A7) represents a dropdown list of {Team1, Team2}
Cell A1 selects the filter for that
I want now select in cell (A1) all data from Team1, to have a table looking like:
A
B
C
1
Team: Team1
2
Team1
Working hours
10
3
Name
Ronald
6
Team1
Working hours
30
7
Name
John
Does anyone know, if that is possible?
A solution would be, to fill every cell of column A with the Team value. However, this is not what I like
Another solution (I guess) is to connect these cells, but this makes it rather complicated if I want to add another attribute per team member (besides Working hours and Name)
I suggest you change your data orientation to be like this (check below picture):
I think it should do the job
How about the following?:
=IF(FILTER(A2:C8,(A1:A7=E1)+(A2:A8=E1))="","",FILTER(A2:C8,(A1:A7=E1)+(A2:A8=E1)))
This solution requires Office365.
The length of both ranges in the filter criteria need to be the same size (row numbers) as the range you want to filter. The range Just shifts (offsets) 1 row to have the second row showing.
Added an IF-argument to show blank cells as blank (they would appear as 0 otherwise).

How to grab specific array and put on specific table in Excel

I want to grab some array depend on specific string.
Name Qty Request
Fruits Apples 54 100
Fruits Bananas 43 100
Fruits Lemons 41 100
Fruits Pears 13 50
Vegetable Cucumber 5 50
Vegetable Kale 10 50
I want to make some table on other sheet and become like this
Pick Type Vegetable
Cucumber 5 50
Kale 10 50
Which Vegetable text is dropdown
I know how to update dropdown and get array B6:D7 using MATCH but I don't know show them as a table.
How about a Pivot Table?
As with many questions here, Excel already has inbuilt functionality
for this. In this case it is actually better to use, than the formulas, since > the table will auto-update itself, even if there's new
item added.
Select the data you want to work with
Insert Tab -> Pivot Table or alternatively press Alt + N + V
Edit the Pivot Table settings (by default on right) to match your criteria. In your case:
After filtering for Vegetables, it provides the expected result:
Put this in G2 then fill right and down.
=IFERROR(INDEX(B:B, AGGREGATE(15, 7, ROW($2:$9)/($A$2:$A$9=$H$1), ROW(1:1))), TEXT(,))
H2
=INDEX($C:$C,MATCH($G2,$B:$B,0))
Drag down.
I2
=INDEX($D:$D,MATCH($G2,$B:$B,0))
Drag down

How to extract values based on criteria in a single column in Excel

I am trying to extract a unique value from a pivot table from a separate sheet in an Excel workbook based on criteria from a single column.
In the example below, I want to extract the number of trucks sold based on make and color. I use the following array formula and one condition works (Ford, Yellow) and the other one does not (Dodge, yellow). Am I using the correct formula? Why does it only work for "Ford", but not for "Dodge"? Is this even possible using pivot tables in separate sheets? Thank you in advance.
{=INDEX($A$2:$B$9,MATCH(A13,$A$2:$A$9,0)*MATCH(B13,$A$2:$A$9,0),2)}
A B
1 Total Sold
2 Ford 49
3 Blue 20
4 Red 13
5 Yellow 16
6 Dodge 37
7 Blue 30
8 Red 6
9 Yellow 1
Inputs Outputs
Ford Yellow 16
Dodge yellow #REF!
Ford Blue 20
You can use
=GETPIVOTDATA("Sold",A1,"Truck",A13,"Color",B13)
where Truck, Color and Sold are the column names of your pivot table data.
Or try something like
=INDEX($B$2:$B$9,MATCH(A13,$A$2:$A$9,0)+MATCH(B13,{"Blue","Red","Yellow"}))

Removing specific rows in Excel

I have a data set in Excel as shown in the snippet below:
Patient Number Age State
1 20 1
1 20 3
1 20 2
2 35 1
2 35 4
3 62 2
3 62 1
3 62 3
3 62 4
3 62 5
I need to keep the last row of each patient, i.e. I need the dataset to look as follows:
Patient Number Age State
1 20 2
2 35 4
3 62 5
Is there a simple way to do this with Excel? Since the dataset is huge and cannot do it manually
If your data is in A:C columns, you can add another column with the following formula in D2:
=A2<>A3
Fill it down. Apply autofilter, choose False in D column and delete all filtered rows.
Edit:
This solution assumes your data is sorted by A column.
Enter below to D2 and press CTRL+SHIFT+ENTER to make it an array formula:
=MAX(IF($A$2:$A$11=A2,ROW($A$2:$A$11)))=ROW()
Advantage of this formula is PatientNumber column doesn't have to be sorted. Formula will find the last entry for each PatientNumber. See below, added one more row for Patient number 1:
You can easily keep the top entry with Data ► Data Tools ► Remove Duplicates. To keep the last entry, you first need to reverse the order.
In an unused Helper column to the right put a 1 in the top row then select all of cells in that column to the bottom of your data and use Home ► Editing ► Fill ► Series to gain a column of sequential numbers.
Sort your data using that new column in descending order.
Choose Data ► Data Tools ► Remove Duplicates using only the Patient column as the criteria for duplication.
Delete the Helper column as it is not longer needed.
Duplicates are deleted from the bottom up so the first value for each patient will be retained.

Excel table : how can I change row and column?

I have a table excel with one column and X rows.
4 various informations
example:
row 1 2 3 4 = informations for 1
row 5 6 7 8 = information for 2
I would like to know how can I do to have these information by row instead of by column?
Example:
paul
madrid
14
victor
canada
23
emilie
paris
18
and I Would like:
paul Victor Emilie
Madrid Canada Paris
14 23 18
If you want change data only once, use Copy/Paste
Switch (transpose) columns and rows
Or if you want use formula
TRANSPOSE function
Or you can use the INDIRECT function instead. It's a bit tricky but it works :
On the same sheet where you have :
Paul
Madrid
23
Victor
Montréal
22
Aude
Copenhague
17
Valérie
Alger
28
Add something like (for example on columns B, C, D) :
1 2 3
4 5 6
7 8 9
10 11 12
etc.
It's easy to do with =X+3 formula and drag down formula.
Then, this matrix represent the position of each element in the list, you now just have to use INDIRECT in this way :
=INDIRECT("A" & B1)
A is the column where are your data
B1 is the position of the first element in the matrix
By draging this formula down and on the right, you will the matrix with the A's elements.
(Using example where source column in G2:G100 and target table in H2:J34.)
Type formula below in first cell of target table (H2):
=OFFSET($G$2;(ROW()-ROW($2:$2))*3+COLUMN()-COLUMN($H:$H);0)
Replacing $G$2 with first cell of source data, $2:$2 with first row of target table and $H:$H with first column of target table (mind the $).
Then just drag formula left and then bottom.

Resources