Partition function

Category: Math

Summary

Indicates where a number falls in ranges.

Syntax

Partition(number, start, stop, interval) The Partition function syntax has these named arguments:
Part
Description
numberRequired. The number that you want to evaluate against the ranges.
startRequired. The number that is the start of the overall range of numbers. The number can't be less than 0.
stopRequired. The number that is the end of the overall range of numbers. The number can't be equal to or less than start.
intervalRequired. The number that is the difference between one range and the next. The number can't be less than 1.

Example

Example
This example assumes that you have an Orders table that contains a Freight field. It creates a select procedure that counts the number of orders for which freight cost falls into each of several ranges. The Partition function is used first to establish these ranges, and then the SQL Count function counts the number of orders in each range.

In this example, the arguments to the Partition function are start = 0, stop = 500, interval = 50. The first range would therefore be 0:49, and so on up to 500.
SELECT DISTINCTROW Partition([freight],0, 500, 50) AS Range,
Count(Orders.Freight) AS Count
FROM Orders
GROUP BY Partition([freight],0,500,50);

Microsoft Support Page

https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/partition-function

Back to Functions