Forum Discussion
Fill in a cell based on an answer from another range
As a General Contractor I am reviewing subcontractors/pricing...
I have a list of prices in Row1 and a list of Contractor Names in Row2
I have a separate tab showing lowest price per trade. I use 'min(row1)' to determine which price is lowest and put it in my final sheet.
At this point, I want to list the name of the contractor that has the lowest price.
If I use min(row1) to find the lowest price, how do I set up the next cell to list the name of the lowest priced contractors?
4 Replies
- cRokitskiCopper Contributor
Thanks Everyone, I'll try them all and see which feels better.
Peter - I agree that vertical is more normal, but we have multiple line items to make adjustments to the price. That can be 10-15 lines or more long. That takes priority of the row vs cols.
Avery - Yeah, I realized the "0" issue. Instead of Min, I used Small with a 0+1, to avoid the zero issue. - PeterBartholomew1Silver Contributor
First I would observe that it is more conventional to enter lists down a column rather than across the sheet as you describe; no doubt you have your reasons.
Legacy versions = INDEX(contractor, MATCH(MIN(price), price, 0)) Excel 365 = XLOOKUP(MIN(price), price, contractor) Return multiple matches = FILTER(contractor, price=MIN(price)) Return 'n' contractor names and prices in ascending order = TAKE(SORT(contractorPrices, 1, 1, TRUE),, n) - AveryMorgan200Brass Contributor
Use XLOOKUP to find the lowest price and return the contractor directly beneath it.
For example, if your source tab is named Quotes, with prices in B1 and contractor names in B2:H2:
=XLOOKUP(MIN(Quotes!B1:H1),Quotes!B1:H1,Quotes!B2:H2)
Put that in the contractor-name cell on your summary sheet. Replace the sheet name and ranges with yours.
If two contractors have the same lowest price, XLOOKUP returns the first. To list all tied contractors in one cell, use:
=TEXTJOIN(", ",TRUE,FILTER(Quotes!B2:H2,Quotes!B1:H1=MIN(Quotes!B1:H1)))
Make sure missing bids aren’t entered as zero, since MIN would treat zero as the lowest price.
- VARSDigitalTin Contributor
Pair MATCH with INDEX: MATCH finds which column holds the lowest price, and INDEX returns the name from the same column one row down. With the prices in B1:K1 and the names in B2:K2 on a tab called Bids (swap in your own range and tab name):
=INDEX(Bids!B2:K2,MATCH(MIN(Bids!B1:K1),Bids!B1:K1,0))
On Excel 365 or Excel 2021 and later, XLOOKUP does the same in one step:
=XLOOKUP(MIN(Bids!B1:K1),Bids!B1:K1,Bids!B2:K2)
Both give the first contractor if two bids tie for the lowest price. To list every tied contractor in one cell (Excel 365 or 2021 and later):
=TEXTJOIN(", ",TRUE,FILTER(Bids!B2:K2,Bids!B1:K1=MIN(Bids!B1:K1)))
Keep the price and name ranges the same width, and keep the 0 at the end of MATCH so it only takes an exact match. A trade with an empty bid cell still works, since MIN skips blanks.
(Drafted with AI assistance; formulas tested before posting.)