以编程方式在Excel和C#中Numbers的绝对值的最大值

时间:2018-11-27 10:35:04

标签: c# excel

我正在编程一个使用excel文件中数据的应用程序。为了获得列范围内的最大数量,我执行以下操作:

 xlRng = sheetReal.Range[sheetReal.Cells[11, i], sheetReal.Cells[41, i]];
 sheetReal.Cells[UsedRow , i].Value = excelApp.WorksheetFunction.Max(xlRng);

这很好。但是现在我想让数字的绝对值最大。我该怎么办?

谢谢

1 个答案:

答案 0 :(得分:0)

更改:

excelApp.WorksheetFunction.Max(xlRng);

收件人:

excelApp.WorksheetFunction.Max(-excelApp.WorksheetFunction.Min(xlRng), excelApp.WorksheetFunction.Max(xlRng));