Dịch dùm mình đoạn này nhé! Creating a Simple Custom Function

Liên hệ QC

thanhxt2009

Thành viên thường trực
Tham gia
9/6/09
Bài viết
212
Được thích
296
Creating a Simple Custom Function

Custom functions, like macros, use the Visual Basic for Applications (VBA) programming language. They differ from macros in two significant ways. First, they use function procedures instead of sub procedures. That is, they start with a Function statement instead of a Sub statement and end with End Function instead of End Sub. Second, they perform calculations instead of taking actions. Certain kinds of statements (such as statements that select and format ranges) are excluded from custom functions. In this article, you’ll learn how to create and use custom functions.
Suppose your company offers a quantity discount of 10 percent on the sale of a product, provided the order is for more than 100 units. In the following paragraphs, you’ll build a function to calculate this discount.
 
Các hàm tự tạo, cũng như macro được tạo ra bởi ngôn ngữ lập trình VBA. Chúng khác macro ở 2 khía cạnh.

Một là, chúng dùng hàm thay vì thủ tục. Tức là, chúng được bắt đầu bằng Function thay vì Sub và kết thúc bằng End Function thay vì End Sub.
Hai là, chúng tiến hành tính toán thay vì thực hiện 1 hành động nào đó.

Có 1 số việc mà chắc chắn hàm tự tạo không thể thực hiện được (ví dụ như là thay đổi định dạng của 1 vùng). Trong phần này, chúng ta sẽ học cách để viết và sử dụng hàm tự tạo.

Cho rằng, công ty của bạn muốn giảm 10% giá thành của 1 sản phẩm, cung cấp cho 1 đơn đặt hàng hơn 100 sản phẩm. Trong đoạn sau đây, bạn sẽ xây dựng 1 hàm để tính sự giảm bớt này.
 
Creating a Simple Custom Function

Custom functions, like macros, use the Visual Basic for Applications (VBA) programming language. They differ from macros in two significant ways. First, they use function procedures instead of sub procedures. That is, they start with a Function statement instead of a Sub statement and end with End Function instead of End Sub. Second, they perform calculations instead of taking actions. Certain kinds of statements (such as statements that select and format ranges) are excluded from custom functions. In this article, you’ll learn how to create and use custom functions.
Suppose your company offers a quantity discount of 10 percent on the sale of a product, provided the order is for more than 100 units. In the following paragraphs, you’ll build a function to calculate this discount.
Tạo một Hàm tự tạo đơn giản
Các hàm tự tạo, giống như các macro, sử dụng ngôn ngữ lập trình VBA. Các hàm này khác với macro ở hai điểm đáng kể. Đầu tiên, các hàm này sử dùng các thủ tục hàm thay vì các thủ tục con. Nghĩa là, chúng bắt đầu bằng một khai báo hàm (Function) thay vì một khai báo con (Sub) và kết thúc bằng Kết thúc Hàm (End Function) thay vì Kết thúc thủ tục con (End Sub). Thứ hai, các hàm này thực hiện các tính toán thay vì chỉ thực hiện hành động. Một vài khai báo (chẳng hạn về select (lựa chọn) và vùng định dạng) bị loại khỏi các hàm tự tạo. Trong bài này, bạn sẽ học cách tạo và sử dụng các hàm tự tạo.
Giả sử công ty của bạn cung cấp một khoản giảm giá 10% số lượng bán hàng cho đơn hàng nhiều hơn 100 đơn vị. Trong đoạn sau, bạn sẽ xây dựng một hàm để tính toán khoản giảm giá này.
 
Lần chỉnh sửa cuối:
I found this paragraph on the internet, pls translate it into vietnamese for me. Thanks so much guys.

An Excel pivot table is a versatile reporting tool that makes it easy to extract information from a large table of data without the use of formulas.
A pivot table is extremely user friendly in that by moving, or pivoting, fields of data from one location to another using drag and drop we can look at the same data in a number of different ways.
This tutorial covers creating and using a pivot table to extract different information from one data sample.
The steps in this tutorial are:

  1. Enter the Pivot Table Data
  2. Create the Pivot Table
  3. Adding Data to the Pivot Table
  4. Filtering the Pivot Table Data
  5. Change the Pivot Table Data
 
Web KT
Back
Top Bottom