• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microsoft Excel Tips and Tricks - Computergaga

  • Home
  • Excel Online Courses
  • Excel Functions List
  • Free Downloads
  • Blog
  • Tutorials
  • About
Home / Archives for Formulas

Two Way Lookup using INDEX and MATCH

The VLOOKUP function will look down the leftmost column of a table and return a value from a specified column index number. To create a two way lookup formula, we will need something more flexible.

The INDEX and MATCH functions can be used to create a two way lookup that looks down a column and across a row.

These two functions used together create a very versatile and dynamic lookup formula. A far cry from the rigid structure of VLOOKUP.

If you are using Excel 365 or Excel 2021 version of Excel, you can also create a two way lookup with the XLOOKUP function. This is awesome and you should definitely check it out. But for now we will stick with the INDEX MATCH combination, and INDEX is the greatest function of all.

In the example, below we wish to look for an order using the ID, and return the salesperson’s name and the order amount using the same lookup formula in both cells.

Sample data for a two-way lookup

The INDEX and MATCH Functions

The two way lookup formula is a combination of the INDEX and MATCH functions. These two functions are fantastic and have many uses in Excel. Let’s have a little look at the two of them first.

The INDEX function is used to return a value from a specified column and row. In addition to its use in a two way lookup, this function is used when working with form controls on a spreadsheet.

When used to return a value it is written as below.

=INDEX(array, row_num, [column_num])

This function wants to know the row and column number of the cell containing the value to return.

The MATCH function is the driving force in this formula. It will be used to find and return the row and column numbers for the INDEX function. INDEX can then return the value from that cell.

The MATCH function is heavily used in many lookup and reference situations to add extra muscle to the likes of VLOOKUP, or Conditional Formatting.

It’s structure is as below.

=MATCH(lookup_value, lookup_array, [match_type])

The lookup value is the value to search for.

The lookup array is the range of cells to search in.

Match type is the type of lookup to use. You can select an exact match, or one that finds the closest match if it cannot find the value you are looking for.

Create the Two Way Lookup Formula in Excel

In this example, the formula below is entered into cell J4 and copied into K4.

Two way lookup formula with INDEX and MATCH

Watch the Video

The Ultimate VLOOKUP Guide

In this Ultimate VLOOKUP guide we begin with an introduction to the VLOOKUP function for newbies, and then look at some more advanced examples of its use.

The VLOOKUP function is one of the most commonly used and powerful functions in Excel. It is often misunderstood and can be tricky to use especially if you are not confident with Excel formulas.

There are many reasons people use VLOOKUP. These range from dynamically linking worksheets, to comparing lists for missing items, to improving and speeding up data entry.

Our guide shows you how to combine VLOOKUP with other Excel functions to achieve more powerful searching within a spreadsheet.

  • Introduction to the VLOOKUP Function
    This introductory VLOOKUP guide shows you when and how to use this function. Understand its anatomy and how to write VLOOKUP formulas to accomplish common spreadsheet tasks.
  • Looking for a Value to the Left (Video)
    A limitation to the VLOOKUP function is that it can only look down the first column of a table and return data to its right. This tutorial looks at using the INDEX and MATCH functions to return data from a column to the left.
  • Create a Two Way Lookup
    Used by itself, VLOOKUP will look at the first column of data in a table and bring back a value from another column on the same row. This is a very rigid lookup.

    This VLOOKUP tutorial looks at how to create a two way lookup to look for a value in a column, but also automatically find the column containing the value to return.
  • VLOOKUP with a Conditional Lookup Table
    If your workbook contains multiple lookup tables, you may want a user to specify which table VLOOKUP should use as the table array.

    This tutorial looks at how you can create a VLOOKUP that uses a table that the user picks from a list.
  • Create a Multiple Condition Lookup Formula
    The VLOOKUP function is typically used to search for a record using a unique ID such as a part code, or customer ID. However you may need to match multiple columns to ensure you have found the correct record.

    This special VLOOKUP tutorial will look at how to create a lookup that matches the data in multiple columns.
  • Create a Case Sensitive Lookup Formula
    The lookup value in the VLOOKUP function is not case sensitive. Learn how to create a case sensitive lookup formula that will find an exact match for the lookup value in the list.
  • Create a Picture Lookup
    If you have a list containing images such as a product list with a picture in one of the columns, you may want to create a lookup that returns the picture.
  • Find the Cell Address of a Value
    Looking up a value and returning data relating to it is great. But you may want to return the cell address of the value you are looking for.
  • Compare Two Lists Using VLOOKUP
    A common Excel task is to compare two lists to find matching or missing records. This tutorial demonstrates using VLOOKUP with the IF function and Conditional Formatting to compare lists.

If you have found this ultimate VLOOKUP guide useful, why not check out more Excel formulas.

Advanced Excel Skills

Excel is an extremely powerful program used by businesses all over the world. Users with advanced Excel skills are in huge demand.

If you are wondering “how to improve my Excel skills?”, you are in the right place. The list below is a collection of advanced Excel tips to enhance Excel skills and make you an Excel superhero.

Advanced Excel Formulas

If you asked someone, what are advanced Excel skills? You can be sure that advanced Excel formulas would be a common response.

Formulas are what drive an Excel spreadsheet. Formulas provide the muscle for a spreadsheet to analyse, manipulate, convert and look up data with incredible speed and power.

An advanced Excel user would need advanced formula skills. They would have a commonly used list of functions that they know well, but also the skills and confidence to adapt to any situation requiring formulas.

Ultimate VLOOKUP function guide

5 examples of the groovy SUMPRODUCT function

The INDIRECT function – 5 great examples

4 alternatives to nested IF formulas

List of Excel functions

Learn more advanced Excel formulas

[Read more…] about Advanced Excel Skills

Excel FILTER Function – The Best Function in Excel

The FILTER function in Excel is a dynamic array function available to Excel 365 users and Excel Online only.

This is an extremely versatile and powerful function – and is possibly the best function in Excel.

It is the formula equivalent of the extremely useful filter feature of Excel. It will return a range dependent upon criteria that you specify.

This range can be returned to a worksheet but also embedded inside other formulas.

The potential for this is huge. With the FILTER function providing the ranges for other formulas, and also our charts and data validation rules etc. This function has changed the game forever.

In this guide, we will introduce you to the FILTER function with different examples. The potential for this function is so vast, that you need to explore it yourself also.

Download the file used in this tutorial to follow along.

Watch the Video

How to Use the FILTER Function in Excel

Let’s take a look at the classic use of the FILTER function. To automatically output a range of data that meet specified conditions.

For example, we have a list of training (columns A:C) with a date column for when that training requires renewing. It has been formatted as a table named training.

And we want to return a list into the range to the right (columns F and G) of the names and expiry dates of the training that is overdue.

Sample data for the formula examples

So in cell F5, we will use the FILTER function.

The FILTER function accepts three arguments – array, include and if_empty.

Excel FILTER function arguments

Array: The range of values you want to be filtered.

Include: The filter criteria. Boolean expressions which will determine what rows or columns to return.

If Empty: The action to take if no results are returned by the filter. This is an optional argument.

The following formula can be used to return the name and expiry date.

=FILTER(training[[Name]:[Expiry Date]],training[Expiry Date]<TODAY(),"All up to date")

The Array is the name and expiry date columns of the table (table references are used in the formula) because this is the information we want to be returned.

The following criteria is used for the Include argument.

training[Expiry Date]<TODAY()

This ensures that the expiry date is before today’s date.

Finally the text “All up to date” will be returned if the FILTER function returns no records.

The following results are returned. A blue border is shown around the “spill” array.

Dynamic array spill results with blue border

Because dynamic arrays have been used here, all results are returned by one formula. However, to edit the formula, you must do this in the first cell of the array only (cell F5).

Excel FILTER Function with Multiple Criteria

The previous FILTER function example has only one criterion – if the expiry date was in the past.

However, let’s test the training course as well. In cell G2 there is a drop-down list for the different courses – call handling, Excel and first aid.

Drop down list of different training courses

We want the FILTER function to return the name and expiry date of the training that has expired AND for the course listed in cell G2.

To do this we need to surround both logical tests in brackets and multiply them.

This is the complete formula.

=FILTER(training[[Name]:[Expiry Date]],(training[Expiry Date]<TODAY())*(training[Training]=G2),"All up to date")

And here is the Include argument isolated so that it is easier to understand.

(training[Expiry Date]<TODAY())*(training[Training]=G2)

The formula returns the following results when Excel is selected.

Formula results dependent upon drop down value

Changing the course in the drop-down would immediately produce the results for that course. Here are the results for First Aid training.

Results of the Excel FILTER function

Why multiply them?

Whenever you want to perform And logic and only include the results where all logical tests are equal to true, you must multiply each boolean expression.

The reason for this is because each test is conducted separately.

So all the expiry dates that are previous to today’s date return a true. This is a snapshot of how the first 11 rows of our data are evaluated.

{TRUE;FALSE;FALSE;FALSE;TRUE;TRUE;TRUE;TRUE;TRUE;FALSE;FALSE}

And then all training that is equal to the value in cell G2 return a true.

{FALSE;FALSE;TRUE;TRUE;FALSE;TRUE;FALSE;TRUE;FALSE;FALSE;TRUE}

The two arrays are then multiplied. The rows that are equal to 1 are the results that are returned.

{0;0;0;0;0;1;0;1;0;0;0}

So multiplying the expressions ensures that all tests must equal to True to evaluate to 1.

How about OR logic?

If you wanted a scenario where only one of the logical tests must equal true to be included, then wrap each boolean expression in brackets and add them with the plus operator (+) instead.

Tidy this up with the IF Function

The previous example works great, but only if cell G2 is populated with one of the course names.

If it is not, then the text “All up to date” is returned. And this is not true.

Use the FILTER function with IF to handle errors

The following formula uses an IF function to test if cell G2 is empty. If it is, then use the FILTER function with no test on a course name, but if it isn’t then use the FILTER function that does test the course name in cell G2.

=IF(G2="",FILTER(training[[Name]:[Expiry Date]],training[Expiry Date]<TODAY(),"All up to date"),FILTER(training[[Name]:[Expiry Date]],(training[Expiry Date]<TODAY())*(training[Training]=G2),"All up to date"))

This formula may seem daunting due to its size. But really it is just two FILTER function being controlled by the IF function and the test on cell G2.

Breaking the formula up onto different lines can make it easier to understand.

=IF(G2="", FILTER(training[[Name]:[Expiry Date]],training[Expiry Date]<TODAY(),"All up to date"), FILTER(training[[Name]:[Expiry Date]],(training[Expiry Date]<TODAY())*(training[Training]=G2),"All up to date"))

Use the FILTER Function with Other Excel Functions

The previous example showed the FILTER function with the IF function.

One of the great advantages of the FILTER function is that it returns an array based on criteria – like a super lookup. And this array could be used in any Excel function.

In the range below we will count the number of training that has expired for each course.

Count the instances of each training

To do this we will combine FILTER with the COUNTA function.

FILTER could be combined with any function – SUM, LARGE, VLOOKUP, MEDIAN making it extremely flexible.

The formula below returns the count of expired training for each course.

=COUNTA(FILTER(training[Name],(training[Expiry Date]<TODAY())*(training[Training]=I1)))

The formula returns the names if the date has expired and training is equal to the value of I1. These names are then counted by COUNTA.

Excel FILTER function with COUNTA

The Excel FILTER function is incredibly useful and will change the way people use formulas.

There are so many scenarios where this function will come in handy. For example, below is a video on using it to create a searchable drop-down list.

Some of these special scenarios will become clear as you play around with it and use it in your workplace.

Conditional Formatting Multiple Columns – 3 Examples

In this blog post, we will explore using Conditional Formatting with multiple columns. And we will run through three different examples of doing so.

Conditional Formatting is typically applied to one cell, or column. It evaluates the cells in that range, and also applies the formatting to that same range.

In this blog post though we take things further to see example of testing and formatting multiple columns.

Using the AND Function with Conditional Formatting

In this first example we want to apply a Conditional Formatting to the data set below.

The dataset that the article will use. A list of quartely sales.

We want to format the row if every value in columns B, C, D and E is greater than or equal to 100.

  1. Select the range of cells you want to format (B2:E7 in this scenario).
  2. Click Home > Conditional Formatting > New Rule.
  3. Select the Use a formula to determine which cells to format option.
  4. Enter the formula below into the box provided.
=AND($B2>=100,$C2>=100,$D2>=100,$E2>=100)
The AND function used in a Conditional Formatting feature.

The column are made absolute in the formula so that it does not move to each cell when we copy it to the right.

Click the Format button and choose what formatting you would like.

The finished article looks like below. Two of the persons met this target.

The completed Conditional Formatting rule with the AND function.

Testing a Threshold Value in a Another Cell

In this example, we would like to format the row if any one of the cells has a value greater than or equal to the value in another cell.

In the data below, we have a threshold value in cell G3 which we would like to test against. The Conditional Formatting rule from the previous example is also still applied.

Sample data of quarterly sales and that has a threshold value entered in cell G3.

Because we are hoping to apply the formatting if any one of the cells is true – we will use the OR function.

Follow the steps from the previous example to create a new rule and enable us to enter a formula.

We will use the following formula. The reference to cell G3 is absolute.

=OR($B2>=$G$3,$C2>=$G$3,$D2>=$G$3,$E2>=$G$3)
OR function within a Conditional Formatting rule to test if at least one values meets our condition.

The rule is applied to the dataset.

Threshold Conditional Formatting rule applied.

You can see that an additional row has been formatted, but it has also overwritten one of the rows from the previous example (Joseph).

Now, the previous rule was more important than this one. So we need to change the order of the rules so that if they are both true, then the rule with the AND function has priority.

Click on one of the values in the range and click Home > Conditional Formatting > Manage Rules.

Use the arrows as indicated in the image below to change the order of the rules so that the AND function is on top. The higher in the list, the greater the priority.

Changing the order of Conditional Formatting rules

Now this is what we wanted.

Conditional Formatting rules applied in the correct order.

And if the value in cell G3 is changed. the Conditional Formatting rule will react to this.

More Than Two Columns Meet Criteria

In this final example, we would like to apply the Conditional Formatting rule if more than 2 of the columns have values of 100 or more.

We will use the COUNTIF function for this.

This function can count how many cells contain a value of 100 or more. And then we can test if the answer to that is more than two.

Follow the steps from the previous examples to create a new Conditional Formatting multiple columns rule using a formula.

The formula below can be used.

=COUNTIF($B2:$E2,">=100")>2
Using the COUNTIF function with Conditional Formatting

The rule is applied to the data range. The previous rules have been removed.

Formatting when more than two column meet criteria.

In this blog post we looked at three different examples of how and why to test multiple columns with Conditional Formatting.

I hope it has given you some ideas where you might be able to apply similar techniques.

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 5
  • Page 6
  • Page 7
  • Page 8
  • Page 9
  • Interim pages omitted …
  • Page 20
  • Go to Next Page »

Primary Sidebar

Recent Posts

  • TEXTSPLIT in Excel: 9 Practical Examples You Can Use Today
  • Create Custom In-Cell Bar Charts in Excel
  • Excel SWITCH Function – Nested IF Function Alternative
  • Sum Formulas Only in Excel
  • How to Calculate Age in Excel
Advanced Excel Success book

Footer

Contact

[email protected]

LinkedIn Twitter YouTube

Useful Links

  • Home
  • Excel Online Courses
  • Tutorials
  • Sitemap
  • Privacy Policy
  • Jobs by Jooble

Course Topics

  • Blog
  • Charts
  • Courses
  • Dashboards
  • Downloads
  • Excel Tips
  • Formulas
  • Mail Merge
  • Office
  • PivotTables
  • Power BI
  • Power Pivot
  • Power Query
  • VBA

Join Our Mailing List

© Copyright 2009 Computergaga · All Rights Reserved ·