mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:37:45 +00:00
Spreadsheet: Add max(If)/min(If) function for ranges
This commit is contained in:
parent
6c35419236
commit
99425c5adc
2 changed files with 79 additions and 0 deletions
|
@ -73,6 +73,7 @@ describe("Statistics", () => {
|
|||
sheet.makeCurrent();
|
||||
|
||||
for (let i = 0; i < 10; ++i) sheet.setCell("A", i, `${i}`);
|
||||
for (let i = 0; i < 10; ++i) sheet.setCell("B", i, `${i * i}`);
|
||||
|
||||
test("sum", () => {
|
||||
expect(sum).toBeDefined();
|
||||
|
@ -104,6 +105,26 @@ describe("Statistics", () => {
|
|||
expect(averageIf(x => !Number.isNaN(x), R`A0:A10`)).toEqual(4.5);
|
||||
});
|
||||
|
||||
test("minIf", () => {
|
||||
expect(minIf).toBeDefined();
|
||||
expect(minIf(x => x > 25, R`B0:B9`)).toEqual(36);
|
||||
});
|
||||
|
||||
test("min", () => {
|
||||
expect(min).toBeDefined();
|
||||
expect(min(R`B0:B9`)).toEqual(0);
|
||||
});
|
||||
|
||||
test("maxIf", () => {
|
||||
expect(maxIf).toBeDefined();
|
||||
expect(maxIf(x => x > 25, R`B0:B9`)).toEqual(81);
|
||||
});
|
||||
|
||||
test("max", () => {
|
||||
expect(max).toBeDefined();
|
||||
expect(max(R`B0:B9`)).toEqual(81);
|
||||
});
|
||||
|
||||
test("median", () => {
|
||||
expect(median).toBeDefined();
|
||||
expect(median(R`A0:A9`)).toEqual(4.5);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue