Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formula calc doesn't work if cell refers to another formula cell #1262

Closed
devloppper opened this issue Jun 30, 2022 · 2 comments
Closed

formula calc doesn't work if cell refers to another formula cell #1262

devloppper opened this issue Jun 30, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@devloppper
Copy link
Contributor

Code

workBook := excelize.NewFile()
	_ = workBook.NewSheet("test")
	_ = workBook.SetCellValue("test", "G6", 2)
	_ = workBook.SetCellValue("test", "H6", 3)
	_ = workBook.SetCellValue("test", "K8", 2022)
	_ = workBook.SetCellFormula("test", "I7", "=LEFT(K8, 2)")
	_ = workBook.SetCellFormula("test", "I6", "=IFERROR(I7,H6)")
	_, _ = workBook.CalcCellValue("test", "I7")
	value, err := workBook.CalcCellValue("test", "I6")
	if err != nil {
		panic(err)
	}

the value will be 20 in excel but it is an empty value

@xuri
Copy link
Member

xuri commented Jun 30, 2022

Thanks for your issue. This library doesn't support calculating formulas for dependence formulas currently. The feature of formula engine is working in progress.

@xuri xuri closed this as completed in a65c584 Jul 10, 2022
@xuri xuri added the enhancement New feature or request label Jul 10, 2022
@xuri
Copy link
Member

xuri commented Jul 10, 2022

Hi @devloppper, I have added support for dependence formulas calculation, please upgrade to the master branch code, and this feature will be released next version.

xuri added a commit to carbin-gun/excelize that referenced this issue Oct 9, 2022
- Add export option `MaxCalcIterations` for specifies the maximum iterations for iterative calculation
- Update unit test for the database formula functions
xuri added a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
- Add export option `MaxCalcIterations` for specifies the maximum iterations for iterative calculation
- Update unit test for the database formula functions
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
- Add export option `MaxCalcIterations` for specifies the maximum iterations for iterative calculation
- Update unit test for the database formula functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants