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

Adding @ for formulas #352

Closed
klar-C opened this issue May 10, 2022 · 6 comments
Closed

Adding @ for formulas #352

klar-C opened this issue May 10, 2022 · 6 comments

Comments

@klar-C
Copy link

klar-C commented May 10, 2022

Hi,

When writing formulas with named ranges, sometimes it adds an "@" in front of the name even though that's not how it was written to openxlsx.

E.g.
SUMPRODUCT((IF(NOT(ISERROR(price)),price,0))(price))
would switch to
SUMPRODUCT((IF(NOT(ISERROR(@price)),price,0))
(price))

This would not happen if I don't have the "IF(NOT(..." around it.

I'm not sure whether this is Excel (when opening the file) or openxlsx.

Will add a reprex asap but maybe someone has come across this before.

@klar-C
Copy link
Author

klar-C commented May 10, 2022

Realized this is a duplicate of
awalker89/openxlsx#519
Apologies.

@klar-C klar-C closed this as completed May 10, 2022
@JanMarvin
Copy link
Collaborator

I've never been able to reproduce the issue. Could you check if the steps to reproduce still apply?

@klar-C
Copy link
Author

klar-C commented May 10, 2022

Following his instructions under awalker89/openxlsx#519 I'm able to reproduce it. The random "@" sign shows up for me.

@klar-C
Copy link
Author

klar-C commented May 10, 2022

To be clear: Doing array=T solves the issue.

But it would be good to know why it actually happens, because in other sections I'm using explicit @-signs in formulas like @RANGE_XYZ-SUM(RANGE_ABC) and there I don't think I can use the array=T clause.

@JanMarvin
Copy link
Collaborator

I'm rather clueless myself, there is no instruction to add @ in openxlsx, therefore the sign must be added for other unknown reasons. What should happen: the formula is written as is, though for whatever reason it is mixed up. Might be some windows problem, but could be completely unrelated.

@JanMarvin
Copy link
Collaborator

I did some research on the topic. The issue is caused by ABS() being an array function. Even tough Excel does not provide the curly brackets, the function itself remains an array function and is written as such. The difference compared to other array functions is in the way Excel hides this from the user. Excel applies something called a cell meta index, a specific value which picks a certain value from metadata.xml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants