ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2016-08-14 01:19:21

qxzhu
Member
Registered: 2016-08-05
Posts: 39

if 函数不起作用?

...    A B   C  D
1    5  6  7   =if(A1>5,B1+C1,B1-C1)  结果D1=0 为什么会这样,在Excel中这样使用是没问题的

Last edited by qxzhu (2016-08-14 01:20:06)

Offline

#2 2016-08-14 06:43:34

oops
Moderator
Registered: 2015-11-03
Posts: 54

Re: if 函数不起作用?

if 需要大写 IF。 另外所有内置的Excel函数名都必须大写。

https://reogrid.net/document/excel-comp … functions/

Offline

#3 2016-08-14 07:19:01

qxzhu
Member
Registered: 2016-08-05
Posts: 39

Re: if 函数不起作用?

明白了。谢谢。
如何用IF来判断A1是不是有数据,如果没填数据cell.data是null

Offline

#4 2016-08-16 01:43:33

oops
Moderator
Registered: 2015-11-03
Posts: 54

Re: if 函数不起作用?

内置函数 ISNUMBER(cell) 可以判断目标 cell 是否是一个数字。

如果需要判断是数字或者字符串,可以添加一个自定义函数 ISEMPTY

Formula.FormulaExtension.CustomFunctions["ISEMPTY"] = (cell, args) =>
{
	// check function arguments
	if (args.Length < 1) return null;

	// check if cell text is not empty
	return !string.IsNullOrEmpty(Convert.ToString(args[0]));
};

使用例:

=ISEMPTY(A1)

Offline

Board footer

Powered by FluxBB