MinAI - Về trang chủ
Hướng dẫn
7/1330 phút
Đang tải...

Named Ranges & Tables

Sử dụng Named Ranges, Excel Tables, và Structured References để quản lý dữ liệu hiệu quả

0

🎯 Mục tiêu bài học

TB5 min

Sau bài học này, bạn sẽ:

✅ Tạo và quản lý Named Ranges (static + dynamic)

✅ Convert data thành Excel Tables (Ctrl + T)

✅ Sử dụng Structured References: [@Column], Table[Column]

✅ Kết hợp Tables + PivotTables cho auto-update

✅ Hiểu Data Model và Relationships giữa tables

Thời gian: 30 phút | Độ khó: Intermediate | Yêu cầu: Hoàn thành Bài 6 - Data Validation

1

📖 Bảng Thuật Ngữ Quan Trọng

TB5 min
Thuật ngữTiếng ViệtMô tả
Named RangeVùng đặt tênĐặt tên cho cells thay vì dùng địa chỉ
Excel TableBảng ExcelStructured range với auto-features
Structured ReferenceTham chiếu cấu trúc[@Column] syntax trong Tables
Name ManagerQuản lý tênDialog quản lý tất cả named ranges
Dynamic Named RangeVùng tên độngRange tự expand khi thêm data
Total RowDòng tổngAuto-calculated row cuối Table
Data ModelMô hình dữ liệuMultiple tables + relationships
Auto-ExpandTự mở rộngTable tự lớn khi thêm data
Banded RowsDòng xen kẽZebra stripes formatting
ScopePhạm viWorkbook hoặc Sheet level

Checkpoint

Named Range đặt tên cho cells, Excel Table là structured range, Structured Reference dùng [@Column]. Cả ba giúp formulas dễ đọc và maintain. Bạn phân biệt được chưa?

2

📛 2. Named Ranges

TB5 min

2.1 Named Range là gì?

Named Range = Đặt tên cho vùng cells thay vì dùng địa chỉ.

fxNamed Range vs Cell Address
Thay vì:
=SUM(B2:B100)khó hiểu
Dùng:
=SUM(Revenue)Dễ đọc hơn! ✅
Thay vì:
=VLOOKUP(A2, $G$2:$I$50, 2, FALSE)khó hiểu
Dùng:
=VLOOKUP(A2, ProductTable, 2, FALSE)Dễ đọc hơn! ✅

2.2 Tạo Named Range

Cách 1: Name Box

  1. Select range B2:B100
  2. Click Name Box (góc trái trên)
  3. Gõ "Revenue" → Enter

Cách 2: Formulas → Define Name

fxDefine Name Dialog
Name: Revenue
Scope: Workbook
Refers to: =Sheet1!$B$2:$B$100
Comment: "Monthly revenue data"

Cách 3: Create from Selection

fxCreate from Selection
Select A1:B100 (bao gồm header "Revenue")
Formulas → Create from Selection → ☑ Top Row
→ Tự tạo Named Range "Revenue" = B2:B100

2.3 Quản lý Named Ranges

Formulas → Name Manager (Ctrl + F3)

📛 Name Manager

NameValueRefers ToScope
Revenue{45K...}=Sheet1!$B$2:$B$100Workbook
Regions{N,S...}=Sheet1!$A$2:$A$100Workbook
Tax_Rate0.1=Sheet1!$G$1Workbook

2.4 Sử dụng trong Formulas

fxNamed Ranges in Formulas
Constants
=Revenue * Tax_Rate
In SUMIF
=SUMIF(Regions, "North", Revenue)
In VLOOKUP
=VLOOKUP(A2, ProductTable, 2, FALSE)
In Data Validation
Source: =RegionListdrop-down từ named range

Named Range cho constants (Tax_Rate, Discount_Rate) giúp thay đổi 1 chỗ → update tất cả formulas. Không cần tìm và sửa từng cell!

Checkpoint

Named Range biến cell addresses thành tên có nghĩa. 3 cách tạo: Name Box, Define Name, Create from Selection. Constants dùng Named Range → update 1 chỗ. Bạn đã thử chưa?

3

🔄 3. Dynamic Named Ranges

TB5 min

OFFSET Formula

fxDynamic Named Range (OFFSET)
DynamicRevenue = OFFSET(Sheet1!$B$1, 1, 0, COUNTA(Sheet1!$B:$B)-1, 1)
Start: $B$1
Offset down 1 rowskip header
Width: 1 column
Height: COUNTA($B:$B)-1đếm non-empty - header
💡 Tự expand khi thêm data mới

Dynamic Named Range tự mở rộng khi thêm data — không cần update range manually. Tuy nhiên, Excel Tables (Ctrl+T) cũng auto-expand và dễ dùng hơn. Chọn tùy tình huống!

Checkpoint

OFFSET tạo dynamic range tự expand khi thêm data. Nhưng Excel Tables là giải pháp hiện đại hơn — cũng auto-expand mà dễ dùng hơn. Bạn biết khi nào chọn cái nào chưa?

4

📊 4. Excel Tables (Ctrl + T)

TB5 min

4.1 Table là gì?

Excel Table = Structured data range với auto-features.

Tạo Table:

  1. Select data range (bao gồm headers)
  2. Ctrl + T → Check "My table has headers" → OK

4.2 Table Benefits

FeatureNormal RangeExcel Table
Auto-expand✅ Thêm row → tự mở rộng
Auto-format✅ Zebra stripes
Auto-filterManual✅ Built-in
Structured Refs✅ [@Column] syntax
Total RowManual formulas✅ Toggle on/off
Named auto✅ Table name = Named Range

4.3 Table Features

Auto-expand:

fxAuto-Expand Feature
Nhập data vào row mới ngay dưới table
→ Table tự mở rộng
→ Formulas tự copy
→ Formatting tự apply
→ Charts tự update

Total Row:

fxTotal Row
Table Design → ☑ Total Row
Laptop 15000 10
Phone 8000 25
Tablet 6000 15
─────────────────────────────
Total 29000 50Click để đổi: Sum, Avg, Count...

Banding Rows / Rename:

fxTable Style Options
☑ Banded Rowszebra stripes
☑ Header Rowfreeze headers
Rename: Table Design → Table Name: "SalesData"

Luôn rename Tables ngay sau khi tạo! "SalesData" rõ nghĩa hơn "Table1". Tên table cũng trở thành Named Range — dùng trong formulas, PivotTables, VBA.

Checkpoint

Excel Table (Ctrl+T) có 6 ưu điểm: auto-expand, auto-format, auto-filter, structured refs, total row, auto-named. Luôn rename table ngay sau khi tạo. Bạn đã convert data sang Table chưa?

5

🔗 5. Structured References

TB5 min

5.1 Syntax

fxStructured References
Reference toàn bộ column
=SUM(SalesData[Revenue])
Reference current row
=[@Revenue] * [@Quantity]
Reference header
=SalesData[[#Headers],[Revenue]]
Reference totals
=SalesData[[#Totals],[Revenue]]
Reference entire table
=SalesData
Multiple columns
=SalesData[[Revenue]:[Cost]]

5.2 So sánh với Cell References

fxStructured vs Cell References
Normal reference
=SUM($C$2:$C$100)Hết 100 rows → sai ❌
=D2*E2Copy xuống → đúng
Structured reference
=SUM(SalesData[Revenue])Auto-expand → luôn đúng ✅
=[@Price]*[@Quantity]Rõ nghĩa, auto-copy ✅

5.3 Calculated Columns

fxCalculated Columns
Thêm calculated column
=[@Revenue]-[@Cost]Type vào header "Profit"
→ Excel tự điền formula cho all rows!
SUMIF với table
=SUMIF(SalesData[Region], "North", SalesData[Revenue])

Checkpoint

Structured References: [@Column] cho current row, Table[Column] cho toàn cột. Auto-expand, dễ đọc, không bao giờ sai range. Bạn đã viết formula với structured refs chưa?

6

🔀 6. Tables + PivotTables & Data Model

TB5 min

6.1 Table → PivotTable

fxTable + PivotTable
Mối quan hệ tuyệt vời
1. Data trong Table → Auto-expand
2. Create PivotTable từ Table
3. Thêm data mới vào Table
4. PivotTable Refresh → Tự include data mới!
So với Normal Range
Normal: Thêm data → Change PT source → Refresh
Table: Thêm data → Refresh → Done! ✅

6.2 Data Model

Multiple Tables + Relationships = Data Model

📦Orders

IDProductID
1P001
2P002
🔗 Key
ProductID

💻Products

ProductIDName
P001Laptop
P002Phone
Relationship

Joined Result

IDProductIDName
1P001Laptop
2P002Phone

Data → Relationships → Create Relationship → PivotTable từ Data Model = Cross-table analysis

Data Model cho phép PivotTable sử dụng data từ nhiều tables cùng lúc — không cần VLOOKUP nối trước. Đây là bước đầu tiến vào Power Pivot!

Checkpoint

Table + PivotTable = auto-update khi thêm data. Data Model = multiple tables với relationships → cross-table PivotTable. Chuẩn bị cho Power Pivot! Bạn đã thử chưa?

7

⚖️ 7. Named Ranges vs Tables

TB5 min

Khi nào dùng gì?

ScenarioNamed RangeTable
Constants (Tax Rate)
Data entry tables
Formula readability
Auto-expandCần OFFSET✅ Built-in
Multiple sheets
Data validation lists
PivotTable sourceOK✅ Better

Best Practice: Dùng Tables cho data + Named Ranges cho constants

Checkpoint

Named Ranges cho constants và cross-sheet references. Tables cho data sets cần auto-expand. Best practice: dùng cả hai — Tables cho data, Named Ranges cho constants. Bạn đã áp dụng chưa?

8

🏋️ 8. Thực hành

TB5 min
Thực hành trên Excel

Kết hợp Named Ranges, Tables, và Structured References trong cùng workbook!

Exercise 1: Convert to Tables

  1. Mở file sales data từ bài trước
  2. Convert data range thành Table (Ctrl + T)
  3. Rename table: "SalesData"
  4. Thêm Total Row: Sum Revenue, Avg Quantity
  5. Thêm 5 rows mới → Verify auto-expand

Exercise 2: Structured References

Thêm calculated columns vào table:

💡 Xem đáp án
Profit = [@Revenue] - [@Cost]
Margin = [@Profit] / [@Revenue]
Status = IF([@Margin]>0.3, "High", IF([@Margin]>0.15, "Medium", "Low"))

Exercise 3: Named Range System

Tạo system cho report:

  1. Named Range: Tax_Rate = 10%
  2. Named Range: Discount_Rate = 5%
  3. Named Range: RegionList = North, South, East, West
  4. Use trong: =[@Revenue] * (1 - Discount_Rate) * (1 + Tax_Rate)

Checkpoint

Bạn đã tạo được Table với structured references và Named Ranges cho constants chưa? Thử kết hợp cả hai: =[@Revenue] * (1 - Discount_Rate) * (1 + Tax_Rate) phải hoạt động!

9

� 9. Tổng Kết

TB5 min

Kiến thức đã học

Chủ đềNội dung chínhTầm quan trọng
Named RangesTạo, quản lý, dynamic OFFSETFormula readability
Excel TablesAuto-expand, format, total rowData management
Structured Refs[@Column], Table[Column]Modern formulas
Tables + PivotTableAuto-update data sourceWorkflow efficiency
Data ModelRelationships between tablesAdvanced analysis
Best PracticesTables cho data, Names cho constantsProfessional Excel

Câu hỏi tự kiểm tra

  1. Named Range khác Table structured reference thế nào?
  2. OFFSET dùng để tạo dynamic range như thế nào?
  3. Khi nào nên dùng Table thay vì Named Range?
  4. Data Model dùng để làm gì?

Bài tiếp theo: Power Query Basics — Import, clean, transform data tự động

Key Takeaways:

  • Named Ranges giúp formula dễ đọc hơn, dynamic OFFSET cho auto-expand
  • Excel Tables (Ctrl+T) tự mở rộng, auto-format, có total row
  • Structured References ([@Column], Table[Column]) — modern formulas
  • Tables + PivotTable auto-update data source — workflow efficiency
  • Tables cho data, Named Ranges cho constants — best practice