How to Create a Database in Excel

Track contacts, collections, and other data

A man using Microsoft Excel to create a database of information

  rawpixel \ Unsplash

Excel database files make it easy to enter, store, and find specific information. Whether it's a personal list of phone numbers, a contact list for an organization, or a collection of coins, Microsoft Excel has built-in tools to keep track of data and find specific information.

This article applies to Excel 2019, Excel 2016, Excel 2013, Excel 2010, Excel for Mac, Excel for Android, and Excel Online.

Enter the Data

A sheet in Excel screenshot

The basic format for storing data in an Excel database is a table. Once a table has been created, use Excel's data tools to search, sort, and filter records in the database to find specific information.

To follow along with this tutorial, enter the data as it is shown in the image above.

Enter the Student IDs Quickly

  1. Type the first two ID's, ST348-245 and ST348-246, into cells A5 and A6, respectively.
  2. Highlight the two ID's to select them.
  3. Drag the fill handle to cell A13.

The rest of the Student ID's are entered into cells A6 to A13 correctly.

Enter Data Correctly

When entering the data, it is important to ensure that it is entered correctly. Other than row 2 between the spreadsheet title and the column headings, do not leave any other blank rows when entering your data. Also, make sure that you don't leave any empty cells.

Data errors, caused by incorrect data entry, are the source of many problems related to data management. If the data is entered correctly in the beginning, the program is more likely to give you back the results you want.

Rows Are Records

Rows in an Excel database screenshot

Each individual row of data in a database is known as a record. When entering records keep these guidelines in mind:

  • Do not leave any blank rows in the table. This includes not leaving a blank row between the column headings and the first row of data.
  • A record must contain data about only one specific item.
  • A record must also contain all the data in the database about that item. There can't be information about an item in more than one row.

Columns Are Fields

Field names in an Excel table screenshot

While rows in an Excel database are referred to as records, the columns are known as fields. Each column needs a heading to identify the data it contains. These headings are called field names.

  • Field names are used to ensure that the data for each record is entered in the same sequence.
  • Data in a column must be entered using the same format. If you start entering numbers as digits (such as 10 or 20) keep it up. Don't change part way through and begin entering numbers as words (such as ten or twenty). Be consistent.
  • The table must not contain any blank columns.

Create the Table

Excel format as table screenshot

Once the data has been entered, it can be converted into a table. To convert data into a table:

  1. Highlight the cells A3 to E13 in the worksheet.
  2. Select the Home tab.
  3. Select Format as Table to open the drop-down menu.
  4. Choose the blue Table Style Medium 9 option to open the Format as Table dialog box.
  5. While the dialog box is open, cells A3 to E13 on the worksheet are surrounded by a dotted line.
  6. If the dotted line surrounds the correct range of cells, select OK in the Format as Table dialog box.
  7. If the dotted line does not surround the correct range of cells, highlight the correct range in the worksheet and then select OK in the Format as Table dialog box.

Drop-down arrows are added beside each field name and the table rows are formatted in alternating light and dark blue.

Use the Database Tools

Excel's Database tools screenshot

Once you have created the database, use the tools located under the drop-down arrows beside each field name to sort or filter your data.

Sort Data

  1. Select the drop-down arrow next to the Last Name field.
  2. Select Sort A to Z to sort the database alphabetically.
  3. Once sorted, Graham J. is the first record in the table and Wilson R is the last.

Filter Data

  1. Select the drop-down arrow next to the Program field.
  2. Select the checkbox next to Select All to clear all check boxes.
  3. Select the checkbox next to Business to add a check mark to the box.
  4. Select OK.
  5. Only two students, G. Thompson and F. Smith, are visible because they are the only two students enrolled in the business program.
  6. To show all records, select the drop-down arrow next to the Program field and select Clear Filter from "Program".

Expand the Database

Expand Excel database screenshot

To add additional records to your database:

  1. Place your mouse pointer over the small dot in the bottom right-hand corner of the table.
  2. The mouse pointer changes into a two-headed arrow.
  3. Press and hold the right mouse button and drag the pointer down to add a blank row to the bottom of the database.
  4. Add the following data to this new row:
    Cell A14: ST348-255
    Cell B14: Christopher
    Cell C14: A.
    Cell D14: 22
    Cell E14: Science

Complete the Database Formatting

Formatting an Excel database screenshot
  1. Highlight cells A1 to E1 in the worksheet.
  2. Select Home.
  3. Select Merge and Center to center the title.
  4. Select Fill Color to open the fill color drop-down list.
  5. Choose Blue, Accent 1 from the list to change the color of the background in cells A1 to E1 to dark blue.
  6. Select Font Color to open the font color drop-down list.
  7. Choose White from the list to change the color of the text in cells A1 to E1 to white.
  8. Highlight cells A2 to E2 in the worksheet.
  9. Select Fill Color to open the fill color drop-down list.
  10. Choose Blue, Accent 1, Lighter 80 from the list to change the color of the background in cells A2 to E2 to light blue.
  11. Highlight cells A4 to E14 in the worksheet.
  12. Select Center to center align the text in cells A14 to E14.

Database Functions

Functions in an Excel database screenshot

Syntax: Dfunction(Database_arr , Field_str|num , Criteria_arr)

Where Dfunction is one of the following:

  • DAVERAGE
  • DCOUNT
  • DCOUNTA
  • DGET
  • DMAX
  • DMIN
  • DPRODUCT
  • DSTDEV
  • DSTDEVP
  • DSUM
  • DVAR
  • DVARP

Type: Database

Database functions are particularly handy when Google Sheets is used to maintain structured data, like a database. Each database function, Dfunction, computes the corresponding function on a subset of a cell range regarded as a database table. Database functions take three arguments:

  • Database_arr is a range, an embedded array, or an array generated by an array expression. It is structured so that each row after Row 1 is a database record and each column is a database field. Row 1 contains the labels for each field.
  • Field_str|num indicates which column (field) contains the values to be averaged. This can be expressed as either the field name (text string) or the column number, where the left-most column would be represented as 1.
  • Criteria_arr is a range, an embedded array or an array generated by an array expression. It is structured such that the first row contains the field name(s) to which the criterion (criteria) will be applied and subsequent rows contain the conditional test(s).

The first row in Criteria specifies field names. Every other row in Criteria represents a filter, which is a set of restrictions on the corresponding fields. Restrictions are described using Query-by-Example notation and includes a value to match or a comparison operator followed by a comparison value. Examples of restrictions are: "Chocolate", "42", ">= 42", and "<> 42". An empty cell means no restriction on the corresponding field.

A filter matches a database row if all the filter restrictions (the restrictions in the filter's row) are met. A database row (record) satisfies Criteria if at least one filter matches it. A field name may appear more than once in the Criteria range to allow multiple restrictions that apply simultaneously (for example, temperature >= 65 and temperature <= 82).

DGET is the only database function that doesn't aggregate values. DGET returns the value of the field specified in the second argument (similarly to a VLOOKUP) only when exactly one record matches Criteria; otherwise, it returns an error indicating no matches or multiple matches.