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

The Excelize XNPV only works when the dates are strings, whereas the Excel XNPV only works when the dates are dates #1989

Closed
grahamorrell opened this issue Sep 7, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@grahamorrell
Copy link

Description

Steps to reproduce the issue:

  1. Set up an XLSX file as pictured below - this is using the same test data as your code based XNPV tests
  2. Specifically column A is formatted as dates in US format (mm/dd/yyyy)
  3. Specifically column E is formatted as Excel dates (UK format in my case)

Screenshot 2024-09-07 132323

Describe the results you received:

In Excel - the XNPV formula in C1 does next expect the dates as text and does not work. You must supply the dates as dates (as seen in cell G1)

In Excelize the opposite is true. Calling CalcCellValue on C1 correctly returns 4447.938 like Excel. Calling CalcCellValue on G1 returns #NUM!

Describe the results you expected:

Excelize behaviour to match Excel

Output of go version:

go version go1.23.1 windows/amd64

Excelize version or commit ID:

github.com/xuri/excelize/v2 v2.8.1

Environment details (OS, Microsoft Excel™ version, physical, etc.):
Windows

@xuri
Copy link
Member

xuri commented Sep 7, 2024

Thanks for your issue. Could you provide the workbook attachment without confidential info?

@grahamorrell
Copy link
Author

Sure, please find attached here. Note I don't think it is a US vs UK date format issue. I think it is a string vs date format issue.

XNPV_Issue.xlsx

@xuri xuri added the confirmed This issue can be reproduced label Sep 8, 2024
@xuri xuri closed this as completed in ad85417 Sep 8, 2024
@xuri
Copy link
Member

xuri commented Sep 8, 2024

Thanks for your feedback. I fixed this, please upgrade to the master branch code by go get -u github.com/xuri/excelize/v2@master, and this patch will be released in the next version.

@xuri xuri added bug Something isn't working and removed confirmed This issue can be reproduced labels Sep 8, 2024
@xuri xuri moved this to Bugfix in Excelize v2.9.0 Sep 8, 2024
@grahamorrell
Copy link
Author

I can confirm that the latest master is now working as expected - thanks so much for the quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Bugfix
Development

No branches or pull requests

2 participants