如何使用Google App脚本找到每个n个单元格值的最高最低最低值。

发布于 2025-01-27 22:24:38 字数 424 浏览 1 评论 0原文

Google App脚本可从Google Sheep中的每个n个单元格值中找到每个n个单元格值的最高高和最低值。假设列中的值为-A1 1 A2 12 A3 8 A4 2 A5 5 A6 9 A7 6 A7 6 A8 8 A9 11 A11 A10 10 A11 7 A12 12 A12 12 A13 5 A14 2 A15 A15 15

根据逻辑的第一五个最高值Columan A的单元格值为12,它位于B列的第一个单元格上,第一个最低值的最低低值是Columan A的五个单元格值为1,该值在C列上,依此类推,依此类推,对于其他五个单元格值要找到从顶部到底部的最高高和最低值。

这是Google Sheet的屏幕截图

google app script to find highest high and lowest low values from an array of cell values for every n cell values from a range in google sheet. suppose the values in A column are as - A1 1 A2 12 A3 8 A4 2 A5 5 A6 9 A7 6 A8 8 A9 11 A10 10 A11 7 A12 12 A13 5 A14 2 A15 15

As per logic the first highest high value of first five cell values of columan A is as 12, which is on B column's first cell and the first lowest low value of five cell values of columan A is as 1, which is on C column and so on for other call values with every five cell values to find the highest high and lowest low values from A column top to bottom.

Here's the screenshot of google sheet

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

万劫不复 2025-02-03 22:24:39

主动范围清单的高和低点

function highsandlows() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getActiveSheet();
  const rgl = sh.getActiveRangeList();
  const fl = rgl.getRanges().map(r => r.getValues().flat()).flat();
  const l = fl.sort((a,b) => a - b)[0];
  const h = fl.sort((a,b) => b - a)[0];
  Logger.log('high: %s, low: %s',h,l);
}

Highs and Lows of Active Range List

function highsandlows() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getActiveSheet();
  const rgl = sh.getActiveRangeList();
  const fl = rgl.getRanges().map(r => r.getValues().flat()).flat();
  const l = fl.sort((a,b) => a - b)[0];
  const h = fl.sort((a,b) => b - a)[0];
  Logger.log('high: %s, low: %s',h,l);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文