How to grab specific array and put on specific table in Excel - 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

Related

Excel: Grouping and restructuring data in Excel

In Excel, I want to convert the table on the top (Initial data) into the one at the bottom (Desired output).
I want to group the items in the second row by the first row, and then generate one column per unique value of the first row and list the items of the corresponding group in that column.
Is there a way to do that without manually copying cells?
Table: Initial data
Fruit
Banana
Fruit
Apple
Fruit
Grape
Vegetable
Spinach
Vegetable
Eggplant
Table: Desired output
Fruit
Vegetable
Banane
Spinach
Apple
Eggplant
Grape
If you have access to the UNIQUE and FILTER functions (Excel 365), you could accomplish this as follows.
Assuming your data is in A1:B5. In D1 enter:
=TRANSPOSE(UNIQUE($A$1:$A$5))
This will get you the unique values from the cells in A in D1:E1. Then in D2 enter:
=FILTER($B$1:$B$5,$A$1:$A$5=D1)
And drag to the right.
I.e. you do this:
Result:

Repeat label in a pivot table but add unique identifier

I'm trying to add a unique identifier in my pivot table.
Say you have this:
Apple 4
Orange 2
Apple 3
Orange 9
Banana 8
With item and quantity representing the labels respectively.
If you throw this in a pivot table and repeat labels, it would be re-arrange in alphabetical order (or really however you set it up). I want it to do this:
Apple-1 4
Apple-2 3
etc
Using the repeat item labels doesn't add this. Any ideas?
Sort your item list alphabetically
Create a new table, in the first column, use the following formula:
=A2 & "-" & COUNTIF(A$2:A2,A2)
In the second one, siomply use =B2
Populate down

If text in two cells exist, this creates a unique number

I am working with an excel file where I need a unique number created if the text in two cells are present: example
Text 1 Text 2 Value
star comet 100
star asteroid 101
asteroid nova 102
nova star 103
asteroid nova 102
star comet 100
nova star 103
I assume its something to do with the IF function but I'm now completely snowblind. Any help?
Thanks
Sort by column1 then by column 2
Use the Excel distinct function
Then add sequential ID to each row.
If you need to, use VLOOKUP to add the IDs to the original sheet
Without sorting, array formulae or VBA and assuming Text 1 is in A1, select ColumnsA:B, DATA > Sort & Filter - Advanced, Copy to: F1 (say), check Unique record only. In H2:
=F2&"|"&G2
in I2 enter 100 and copy H2:I2 down to suit.
In C2:
=VLOOKUP(A2&"|"&B2,H:I,2,0)
and copy down to suit.
A PivotTable is an alternative for constructing a list of unique pairs.

If found in Column A, display entire row

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

MIN function in Excel

I need to find minimums in a list of companies and prices. For example in one column I have apples, pears and grapes. For each of these there are several sellers and each of them has a different price. The list in the A coulmn would be Apple, Apple, Apple, Grapes, Grapes, Pear, Pear, Pear, Pear. In B would be Target, Trader Joe's, Harris Teeter etc... And in column C would be the price. Fruits in column A are in alphabetical order. I need to find a separate minimum for every fruit. I can do that manually except I have thousands of rows of data.
I'm thinking along the lines that I need to specify the area in which I want to return the minimum from. That would be as long as the entity in column A is the same, that's the area.
Does anyone know a solution for this problem?
If data starts at row 2 (headers in row 1) try this formula in D2 copied down
=IF(A2=A1,"",MIN(OFFSET(C2,0,0,COUNTIF(A:A,A2))))
That will give you the minimum price on the first row of each fruit. Filter column D on non-blanks to see just the minimums
Use a combination of IF and MIN
=MIN( IF ( logical_test, value_if_true, value_if_false ) )
e.g.
=MIN( IF ( A2:A100="Apple", B2:B100, 0 ) )
You can use PivotTables:
Select your data and insert a PivotTable:
Choose a location to put it. I'll put it in the same sheet:
Click, drag and drop the fruits under Row Label and the Price under Row Values:
Right click on the PivotTable and pick Summarise by > Minimum:
And you should end up with this:

Resources