
Image by Editor
Excel is one of the most popular tools for working with data. Because of its popularity and flexibility, users tend to use it like a database. Many people treat it like a database, storing customer information, sales data, or inventory, performing analysis, and creating reports. But while Excel can simulate some database features, it has limitations. In this tutorial, we show how to use Excel like a database — and when you really shouldn’t.
1. Setting Up Excel as a Database
Let’s say you have small business data that tracks sales, customers, and their orders with regions.
- Open a blank worksheet
- Arrange your data in tabular form (rows = records, columns = fields)
- Add headers (e.g. OrderID, Date, CustomerID, ProductID, Quantity, UnitPrice, SalesAmount)

Step 1: Structure Your Data in Tables
- Convert each range into an Excel Table
- Go to the Insert tab >> select Table
- Check “My table has headers”
- Click OK

- Go to the Table Design tab >> select Table Name
- Name them: tblSales, tblProducts, tblCustomers, and tblRegions

Excel Tables are dynamic. They expand automatically when you add new rows, and formulas/filters adjust accordingly.
Golden Rule: Each column = one field; each row = one record. No blank rows, no merged cells.
Step 2: Ensure Data Integrity
- Each column should hold one type of data (e.g., dates in the Date column)
- Avoid merged cells
- Use Data Validation
- Go to the Data tab >> select Data Validation to restrict input
- Choose criteria (whole numbers, dates, lists, etc.)
- Set input and error messages

Step 3: Use Filters and Sorting
- Click the filter dropdowns in your Table headers
- Filter by date ranges, numbers greater than X, or text containing Y
- Sort data alphabetically, numerically, or by custom order

This mimics the SELECT … WHERE … ORDER BY functionality in databases.
2. Querying Data in Excel
2.1. Using Formulas (Database-Like Queries)
Lookup attributes (1:1):
- Get product attributes in the sales sheet
=XLOOKUP([@ProductID], tblProducts[ProductID], tblProducts[ProductName])

Lookup customer name for each order:
- Insert a column and use XLOOKUP (or VLOOKUP) to get the customer name
=XLOOKUP([@CustomerID], tblCustomers[CustomerID], tblCustomers[CustomerName])

Now each order shows its customer’s name.
This is like an SQL JOIN.
Aggregate facts (many:1):
- Total sales on Orders (if not prefilled in dataset)
=LET(oid, [@OrderID], SUM(FILTER(tblSales[SalesAmount], tblSales[OrderID]=oid)))

Filter subtable:
- Find all orders for a selected customer
=FILTER(tblSales, XLOOKUP(tblSales[CustomerID], tblCustomers[CustomerID], tblCustomers[CustomerName])="John Smith")

In SQL, this is like:
SELECT * FROM Sales JOIN Customers ON Sales.CustomerID = Customers.CustomerID WHERE CustomerName = 'John Smith';
2.2. Analyze with PivotTables (SQL-Style GROUP BY)
PivotTables are Excel’s answer to SQL GROUP BY statements.
- Go to the Insert tab >> select PivotTable >> select Table/Range tblSales
- Select New Worksheet >> click OK

- From PivotTable Fields
- Drag ProductName to Rows
- Drag SalesAmount to Values
- Drag Date to Columns

Insert Slicer:
- Go to the PivotTable Analyze tab >> select Insert Slicer
- Select CustomerName
- Click OK

Tip: Format currency fields.
In SQL, this is like:
SELECT ProductName, SUM(Quantity*UnitPrice) FROM Sales GROUP BY ProductName;
2.3. Use Power Query for Repeatable Joins (ETL)
Power Query is Excel’s built-in ETL (Extract, Transform, Load) tool.
Import data:
- Go to the Data tab >> select Get Data >> select From Table/Range
- Import both tblProducts and tblSales

- A Power Query window appears with the tables

Merge Sales with Products:
- Go to the Home tab >> select Merge Queries

- Select tblProducts, join on ProductID
- Click OK

- Click the tblProducts expand icon
- Select Category, Supplier, UnitCost
- Click OK

- Click Close & Load to import the merged data

- Refresh whenever inputs change; your pipeline stays clean and deterministic

Use Power Query also to:
- Clean text (trim/split), fix types, remove duplicates
- Append files from a folder into one fact table
- Create calendar tables
3. Simulate Relationships with Data Model (Power Pivot)
Databases thrive on relationships. Excel doesn’t natively support this on worksheets, but you can mimic it:
- Store different entities in separate sheets (e.g., Customers, Orders)
- Use VLOOKUP, XLOOKUP, or INDEX + MATCH to bring related data together
- Lookup customer name from the Customers table into the Sales table using CustomerID
If you want real relationships (without XLOOKUP chains), use the Power Pivot add-in.
Use Power Pivot:
- Load each table into the Data Model
- Go to the Power Pivot tab >> select Add to Data Model

- To create a relationship, select Manage
- Go to the Home tab >> select Diagram View
- tblSales[CustomerID] → tblCustomers[CustomerID]
- tblSales[ProductID] → tblProducts[ProductID]
- tblCustomers[RegionID] → tblRegions[RegionID]

- Add simple DAX measures:
Total Sales:=SUM(tblSales[SalesAmount]) Orders Count:=DISTINCTCOUNT(tblSales[OrderID])

- Now use Power Pivot to analyze across tables without formulas
- Go to the Home tab >> select PivotTable

- You can build PivotTables combining fields across tables
- Drag Category from tblProducts to Rows
- Drag SalesAmount and Profit (value as %) from tblSales to Values

This is closest to how foreign keys work in databases.
When You Really Shouldn’t Use Excel as a Database
Excel is a go-to tool for data analysis, and it also works great for small-scale, individual projects, but it has limits. Let’s explore when to stop and move to a real database:
- Data Size: Excel supports ~1 million rows; databases handle billions efficiently
- 1,048,576 rows × 16,384 columns
- 32,767 characters per cell
- Number of worksheets is limited by available memory
- Limited memory for complex calculations
- Performance warning signs: Excel slows down as file size and complexity increase; databases handle large workloads reliably
- File sizes over ~50MB
- Calculation times over ~10 seconds
- Frequent crashes or freezing
- Users avoid opening the file
- Multi-user access: Excel files are fragile under concurrent editing; databases support safe concurrency
- Only one person can edit at a time
- Collaboration becomes painful
- Higher risk with multiple editors
- Version confusion (e.g., “Which file is current?”)
- Security: Excel passwords are weak compared to database encryption and user roles; databases offer PII handling, backup/restore, and role-based access
- Data integrity: Without constraints (like primary keys), duplicate or inconsistent records creep in
- Automation: Databases integrate seamlessly with applications, APIs, and reporting systems
Keep Excel as your front end (Power Query/Pivot) and let a real database system be the back-end source of truth.
Imagine a sales manager:
- In Excel: They maintain 5,000 rows of customer orders, apply filters, and run PivotTables for monthly reports
- As data grows to 500,000 rows across multiple branches, Excel becomes slow and error-prone
- Solution: Move the data to SQL Server, then connect to Excel for reporting
Conclusion
You can use Excel as a mini database for small datasets with Tables, PivotTables, Power Query, and Data Models. You can filter, query, join tables, and even simulate relationships. However, when your data grows, when multiple users need access, or when security is a concern, you require a robust database system. Think of Excel as your analysis and calculations tool, not your warehouse. For collaboration, scale, and governance, graduate to a real database and keep Excel as the friendly analysis front end.
