MIN function in Excel - 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:

Related

Displaying a label, sorted in a third column pulled from the first column according to data in the second column? i.e. Ranking

Imagine you have spreadsheet with data in a fixed # of contiguous rows.. let's say row 1 through row 20
Now let's say you have 3 columns of interest.
A, B and C
Column A is a label column.. the data in there are just string labels.. let's say types of canned food.. Tuna, Spam, Sardines, etc.
Column B is our number column.. let's say it is prices. e.g. 2 for Tuna, 5 for Spam and 3 for Sardines. These prices can change often very rapidly.. ok so prices are not the best example but let's imagine that prices change rapidly.
Now Column C is where we want to put the formula.
I would like to have a formula in Column C that will pull the labels from Column A, based on their prices in column B and rank them from highest to lowest.. that is C1 would calculate to "Spam", C2 to "Sardines" and C3 to "Tuna"
right now there are 20 rows of data.. but maybe at some other point there might be 30 or 6 or 40, etc.
So can someone help me out with the formula or at least explain what functions I need to use and the general idea involved? thanks
=IF(A2:A200<>"";SORTBY(A2:A200;B2:B200;-1);"")
You can simply use SORT formula. In this case =SORT(A1:B1000,2,-1) where A1:B1000 is range to be sorted, second parameter 2 is column number from range to sort by, 3rd parameter for order (-1 is desceding).
Place formula in C1 and you will get spilled array.

Fill in table based a column of categories in Excel

I have a table that looks like this:
Type Value
Movie 5
Food 3
Gas 10
Food 2
.... ....
And There's a second table I want to fill in with "Value" based on their type in the first table, so that the corresponding rows look like this:
Rent Food Movie Gas Clothing ... ( appear in specific order bc they are subcategories)
5
3
10
2
The title row is already there, so I was thinking there might be some kind of lookup method to do this? How do I do that?
your second table apperas to hold one value per row but it doesn't have a label. it does correlate to the original row number, is this by design or coincidence?
if this is by design then you can use those 2 columns, hide them if you like, get a unique list of categories by copying you r abels to a new colum, removing duplicates in the data tab, then paste special transpose in c1 to create colum headers.
so column a and b remain unchanged
row 1 contains header starting at column c
your data starts at c2
this is the formula
=Iferror(vlookup(C$1,$A2:$B2,2,false),"")
drag it down and to the right
you can copy paste special values when done to remove the formulas
for something with only a hundred or thousand cells this will be one of the easier options but i would not do this on large tables, for those i would use power query or VBA
Assuming your 1st table is in Sheet1 and 2nd table is in sheet2.. you may try to fill in Sheet2!A2
=IF(Sheet1!$A2=A$1,Sheet1!$B2,"")
and drag it all the way.. Hope you get how it works.. and what you need.

Advanced Lookup required

I'm in need of some advanced lookup formula with MAX, MIN, IF and SUM. Info:
Sheet1 (data):
Column one(A): name
Column two (B): Type
Column three (D1:AO): Data/numbers
Row 1: A1=Name, B1= Type, D1:AO1=name of the different data
Sheet2 (output):
B5: Primary Critera, Selecting from a dropdownlist of Sheet1.Row(D1:AO1)
B7: Secondary Critera, Selecting from a dropdownlist of Sheet1.Row(D1:AO1)
B8: Tertiary Critera, Selecting from a dropdownlist of Sheet1.Row(D1:AO1)
B9: Quaternary Critera, Selecting from a dropdownlist of Sheet1.Row(D1:AO1)
B10: Quinary Critera, Selecting from a dropdownlist of Sheet1.Row(D1:AO1)
What I want:
Step 1:
I want it to find the row in sheet1(D1:AO1) that matches Sheet2(B5), and find the Maximum value in that column and paste the name Sheet1(Column one).
Step 2 (Maximum criteria):
There are five different types Sheet1(Column two). I want it to find Step 1 for each of them (so five Maximum value, pasting the name in five different cells).
Step 3 (Minimum criteria):
Sheet2(B7:B10) are four minimum criteria (such as =<10), which also needs to be taken into consideration (unless its "None"). Like step one these four cells are dropdown lists.
Step 4 (Total):
Sum up the values of each of the criteria in different cells.
Example:
Type 1-5: Books, Cd's, DVD's, Clothes, Shoes - 100 different of each Type
B5: Primary Criterion: Selling Price
B7: Secondary Criterion: Market value =< 10
Then I want it to find the highest selling price (Primary Criterion), with a minimum market value of 10, for each Type 1-5. Also, pasting the sum of selling price (five prices in total), and pasting the sum of market value (five values in total).
This is how I tried to start step 1:
If(B5="None";"";MAX(VLOOKUP(B5='Sheet1!'!D1:AO1
But, I got stuck since it's lookup in sheet1.cells(D1:AO1), and pasting is column one.
Also, it would even be a great help if you could just solve one of the steps.
EDIT - STEP 1:
A formula that says
1) Look for a cell in Sheet1.row1, where the text matches the text in Sheet2(B5).
2) If you find one, Search the specific column with the match, for the maximum value.
3) return/paste the text from column A, of which row of the maximum value.
In B9 please try:
=INDEX(A:A,MATCH(MAX(OFFSET(A:A,,MATCH(B7,1:1,0)-1)),OFFSET(A:A,,MATCH(B7,1:1,0)-1),0))

Merge multiple values in one column into same cell

EDIT: The intended output is to have one spreadsheet of the untouched IDs and commodity categories, and one spreadsheet with 1 occurrence of ID with the commodity categories combined. This is because I'm writing reports on total number of commodities and total number of unqiue incidents.
I have a spreadsheet that has an ID number across multiple rows with a commodity category and what I need to do is get the commodity categories associated with that ID number into the same cell. I'm seeing a lot of stuff about INDEX/MATCH but I'm not sure how it applied to my specific example.
Most examples are outputting data from the same column into the same row/multiple columns or something slightly different. I need to do this row about 600 rows and all have varying amount of rows and values. Some IDs have only one value, some have 40 values, and some have 2. Appreciate the help.
The intended input/output is below.
EX:
ID Commodity Category
A01-0301 Food and Beverage
A01-0301 Apparel and Accessories
A01-0301 Food and Beverage
A01-0302 Other
ID Commodity Category
A01-0301 Food and Beverage, Apparel and Accessories, Food and Beverage
A01-0302 Other
'Dirty' but might be adequate, assuming ID is in A1:
Sort by ID, copy last populated cell in ColumnA down one cell. In C2:
=IF(A1=A2,C1&","&B2,B2)
in D2:
=A2=A3
Select all, Copy, Paste Special, Values over the top, filter ColumnD to select TRUE and delete visible, adjust bottom entry.

Searching 2D Excel array for a value, returning the value of the adjacent cell

I've been scouring this website throughout my last 2 programming classes, and decided it was worth joining this fabulous community!
In a nutshell, I want to create an "invoice maker", which allows one to first select a category via a dropdown box in A1, then an item within that category with a dropdown in B1. Excel would then autofill the price in the next column C1.
Essentially 2 (not sure what to call it: cascading, nested, dependent) dropdown boxes that when both filled, return a price. For example:
A B C
1 Category Item [Price]
Both dropdowns use Data Validation referring to a Defined Name, which is based on an array in sheet "Database". This sheet is formatted like so:
category1 price category2 price category3 price category4 price ...
item1 $xx item1 $xx item1 $xx item1 $xx
item2 $xx item2 $xx item2 $xx item2 $xx
I used this column arrangement mainly because it allows for each category to be expanded indefinitely. If you see a simpler way, let me know!
Essentially, to print the price in C1, my objective is to find the item name in the 2D Excel database, and return the cell immediately to the right of it. Ideally the formula in C1 would use cell A1 to determine which category to search, and search this column for the corresponding item name in B1. Then, it would +1 offset that to the right, thereby referring to the price.
As far as formulas, I have some rough pseudocode, but I'm confused between VLOOKUP, OFFSET, MATCH, and INDEX. Basically:
=INDEX( "defined name of my entire database" , MATCH( B1, **column corresponding to chosen component** , 0 ) + 1 , MATCH( A1 , components , 0 ) )
The way I see it, the INDEX would return the value of row+1 item, in a given column. The first MATCH would find the row in which the item is found, and the second MATCH would determine the column that category is found in.
Now my question is, how do I make the first MATCH search ONLY the column which corresponds to the right category?
Honestly I have no idea if my pseudocode is correct. I translated it to Formula, and it simply returns #N/A in the cell.
Many thanks for any help!!!
I would try the following approach:
Take the first column of the database sheet and offset it so many columns to right how the searched category is offset from the left. Then we have the price column of this category because we have offset it 1 column if it matched the first categrory, 3 if it matched the second category and so on.
From this column indicate the value from the row which is the same as the row in the found offset-1 column (the category column) which matches the searched item name.

Resources