Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
351 views
in Technique[技术] by (71.8m points)

vlookup - Excel, Search two columns for different values on the same row, return results from a cell in that row

I'm trying to make a search through a data sheet to fill in cells that will be printed as a chart.

The search will need to match two criteria that are on the same row, then return the value from another cell in that same row. It will look for a week# and location on the same row, then return a score that is several columns down on that row.

My intention was to use a a couple LOOKUP with an AND statement to build some kind of megafunction. Like IF(AND(VLOOKUP($H$27,B:B,"",FALSE)<>(VLOOKUP($G$26,C:C,42,FALSE))) I would need both of the search criteria to match before it returned the value from column 42.

Week# and score for the X&Y of the chart. You would input the location in a cell($G$26) for the search and it would populate the cells for the chart. Each reference cell in the chart would use the formula with the only difference being what week it looks at.

I willing to accept that I may be going about this in a terrible way.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The syntax for VLOOKUP is VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) where lookup_value must be a single criterion. The simplest solution to look up a result based on multiple criteria can be to convert multiple criteria into a single criterion, with concatenation. Instead of trying to find a match for “John where also Smith”, string the two together (eg =A1&B1) and seek to match “John Smith”. To avoid corrupting the source data this usually means adding a helper column to contain =A1&B1 (or a helper row in case of HLOOKUP and say =A1&A2). The table_array may also require an additional column (or row) to hold values such as "John Smith".


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...