EXCEL, 4 ways to query number/text content with multiple conditions

Table of contents

1 Question: How to query the desired content based on multiple conditions

2 Method summary

2.1 Method 1: sumif() and sumifs() are suitable for finding the sum of multiple values ​​that meet the conditions

2.2 Method 2: use lookup(1,0/((area 1=condition 1)*(area 2=condition 2)*....), result query area) 

2.3 Method 3: Use index()+match()+array formula

2.4 Method 4: vlookup()+if()+array formula


1 Question: How to query the desired content based on multiple conditions

  • For example the following question
  • It needs to be queried according to 3 conditions at the same time, the contents of other columns D and E
  • In general, match() and vlookup can only support single condition query

2 Method summary

In fact, try not to use the entire column directly in the following array formula. It will be a bit slow to calculate. It is more economical to lock the upper and lower limits of the column to be checked.

If you need to query the sum of multiple numbers that meet the conditions

  • Use sumif() and sumifs() to query and summarize numbers, and support summarizing the sum of multiple eligible data.
  • Using sumif() sumifs() cannot query text and will return 0

If it is necessary to query the number/text string that meets the conditions, there is only one

  • use lookup(1,0/(),range()) 
  • Use match(Condition 1&Condition 2&Condition 3, Area 1&Area 2&Area 3,0)
  • Use vlookup(Condition1&Condition2&Condition3, if({1,0},Area1&Area2&Area3,ResultArea,OffsetColumns, false)

2.1 Method 1: sumif() and sumifs() are suitable for finding the sum of multiple values ​​that meet the conditions

  • sumifs() is only good for finding numbers,
  • Checking the value can not only check one data, but also summarize the sum of multiple eligible data
  • But it is not suitable for finding the content of the text string type, and the search text will only return 0

2.2 Method 2: use lookup(1,0/((area 1=condition 1)*(area 2=condition 2)*....), query area) result query area) 

  • Pay special attention to this, the usage of 1, 0
  • lookup(1,0/((area 1=condition 1)*(area 2=condition 2)*....), result query area)
  • It should be noted that the multiple conditions of the denominator must be enclosed in curly braces
  • It should be noted that the multiple conditions of the denominator are the relationship to be multiplied
  • Principle explanation
  • The qualified subhead is 1, 0/1=0, while the unqualified denominator is 0, 0/0

2.3 Method 3: Use index()+match()+array formula

  • Also using the helper column approach
  • &&& can be directly used as an auxiliary column, and multiple columns to be queried as an area

2.4 Method 4: vlookup()+if()+array formula

  • The magic lies in the use of if({1,0}, area 1, area 2)
  • Because {1,0} is an array, and if({1,0}, area 1, area 2) means a combination of multiple areas, so any area can be combined arbitrarily!
  • In the formula IF({1,0,0},A:A&B:B&C:C,E:E), {1,0,0} in 2 is an array, that is, let if execute 3 times, and then do this
    time The results are added up to form a new area
    IF({1,0,0}, the first must be 1, because the index area of ​​the query needs to be queried to the right, this is a feature of vlookup
    and the following numbers 2 and 3 refer to Vlookip needs cheap columns, which need to correspond to {1,0,0}.
    For example, for {1,0,0}, the first column is the merged A&B&C column, and the second and third columns are E columns. For example,
    for {1,1,0}, the first column is the merged A&B&C column, and the second column is also the merged A&B&C column, only the third column is E column
     

Guess you like

Origin blog.csdn.net/xuemanqianshan/article/details/132053388