Find matching value in a row and return column name?
I have a sample price and I want to find the company that offers the lowest or an equal price to that sample price in the same row and put their name in the "Company Name" column. I tried to use IF to compare and but it results in "Too many arguments" error with large table. Can anybody tell me how to achieve it?
Price Company A Company B Company C Company Name
5 5 6 7 Company A
3 9 3 8 Company B
Solution 1:
Ok, lets go. Your question says "lowest or equal" to the sample price, but don't say what to do if the price is greater than the sample price. So I am just going with the lowest:
This finds the lowest price (I am assuming the company columns are B-D):
=min(B2:d2) (equals 5 for your first row)
This finds the column position of the lowest price:
=match(min(b2:d2), b2:d2,0) (equals 2 because that is the position of the lowest (5) in your first row)
This returns the value within the first row that has the column with the lowest value:
=index(b$1:d$1 ,match(min(b2:d2), b2:d2,0))) (returns "Company A" - the contents of that cell)
So the last formula is all you need, the previous steps are just to explain how we got there.