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

Eager evaluation of function arguments doesn't work with LOOKUP functions #2070

Open
2 tasks done
xaoctech opened this issue Jan 21, 2025 · 0 comments
Open
2 tasks done
Labels
enhancement New feature or request

Comments

@xaoctech
Copy link

Description

It seems excelize evaluates all function arguments before calling a function, which doesn't work well with LOOKUP (HLOOKUP, VLOOKUP ...) functions, especially if table range is large.

E.g. =VLOOKUP(C1, A:XFD, 2) will try to calculate all the cells in the table, instead of just lazily calculating cells in A column, and then calculate a corresponding single cell from B column.

Steps to reproduce the issue

  1. Add this simple table to the project
    vlookup.xlsx

  2. Run this code

package main

import (
	"fmt"
	"github.com/xuri/excelize/v2"
)

func unwrap[T any](v T, err error) T {
	if err != nil {
		panic(err)
	}
	return v
}

func main() {
	file := unwrap(excelize.OpenFile("vlookup.xlsx"))
	val := unwrap(file.CalcCellValue("Sheet1", "C2"))
	fmt.Println(val)
}

Describe the results you received

It takes ages to calculate this field value.

Describe the results you expected

It should be instant to calculate this cell value.

Go version

1.23.4

Excelize version or commit ID

2.9.0

Environment

Windows 11

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@xaoctech xaoctech changed the title Eager evaluation of function argument doesn't work with LOOKUP functions Eager evaluation of function arguments doesn't work with LOOKUP functions Jan 21, 2025
@xuri xuri added the enhancement New feature or request label Jan 27, 2025
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