Multi-Layered Searching in Excel

I have an excel spreadsheet with a list of states, elections in each state, politicians in any given senate/governor race, and the party affiliations of each of those politicians. I would like to create a bar denoting whether each race has a Libertarian competing in it. In my head, it looks something like this:

  1. Create range that includes all rows.
  2. Check current politician’s state. Narrow range to include only rows from that state.
  3. Check current politician’s race. Narrow range to include only rows from that race.
  4. Use COUNTIF to count the number of times “Libertarian Party” appears in the range.
  5. If number > 0, there is a Libertarian in a race. Return TRUE. Else return FALSE.

See here for example spreadsheet. SPREADSHEET.

  • Adjusting the formula in formulaarray
  • VBA - Loop Through Array, Assign Value to Different Array
  • How do I set selection to Nothing when programming Excel using VBA?
  • How can I substitute quotation marks in Excel with SUBSTITUTE formula?
  • Excel Looping through rows and copy cell values to another worksheet
  • Ping IP Address with VBA code and return results in Excel
  • What is the actual code for this? What commands should I use?

    One Solution collect form web for “Multi-Layered Searching in Excel”

    You can use a COUNTIFS formula like:

    =IF(COUNTIFS(A:A,A2,B:B,B2,D:D,"Libertarian Party")>0,"TRUE","FALSE")
    MS Excel Spreadsheet is the best Office Software, Excel VBA and Excel Formulas make Spreadsheet work faster.