How to Create a Database in Excel
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
|MOWEBSYS ENROLLMENT 2019-2020|
|STUDENT ID||LAST NAME||INITIAL||AGE||PROGRAM|
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
- Type the first two ID’s, ST348-245 and ST348-246, into cells A4 and A5, respectively.
- Highlight the two ID’s to select them.
- 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
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
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
Once the data has been entered, it can be converted into a table. To convert data into a table:
- Highlight the cells A3 to E13 in the worksheet.
- Select the Home tab.
- Select Format as Table to open the drop-down menu.
- While the dialog box is open, cells A3 to E13 on the worksheet are surrounded by a dotted line.
- If the dotted line surrounds the correct range of cells, select OK in the Format as Table dialog box.
- 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
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.
- Select the drop-down arrow next to the Last Name field.
- Select Sort A to Z to sort the database alphabetically.
- Once sorted, Chalton Q. is the first record in the table and Zeralton B. is the last.
- Select the drop-down arrow next to the Program field.
- Select the checkbox next to Select All to clear all check boxes.
- Select the checkbox next to JAVA to add a check mark to the box.
- Select OK.
- Only two students, Dalton W and Ralton I, are visible because they are the only two students enrolled in the JAVA program.
- To show all records, select the drop-down arrow next to the Program field and select Clear Filter from “Program”.
Expand the Database
To add additional records to your database:
- Place your mouse pointer over the small dot in the bottom right-hand corner of the table.
- The mouse pointer changes into a two-headed arrow.
- Press and hold the right mouse button and drag the pointer down to add a blank row to the bottom of the database.
- Add the following data to this new row:
Cell A14: ST348-255
Cell B14: Chriselton
Cell C14: A.
Cell D14: 22
Cell E14: Python
Complete the Database Formatting
- Highlight cells A1 to E1 in the worksheet.
- Select Home.
- Select Merge and Center to center the title.
- Select Fill Color to open the fill color drop-down list.
- Choose Blue, Accent 1 from the list to change the color of the background in cells A1 to E1 to dark blue.
- Select Font Color to open the font color drop-down list.
- Choose White from the list to change the color of the text in cells A1 to E1 to white.
- Highlight cells A2 to E2 in the worksheet.
- Select Fill Color to open the fill color drop-down list.
- Choose Blue, Accent 1, Lighter 80 from the list to change the color of the background in cells A2 to E2 to light blue.
- Highlight cells A4 to E14 in the worksheet.
- Select Center to center align the text in cells A14 to E14.
Syntax: Dfunction(Database_arr , Field_str|num , Criteria_arr)
Where Dfunction is one of the following:
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.