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

onVariable - access to cell position #30

Closed
rmdort opened this issue Nov 21, 2020 · 9 comments
Closed

onVariable - access to cell position #30

rmdort opened this issue Nov 21, 2020 · 9 comments

Comments

@rmdort
Copy link
Contributor

rmdort commented Nov 21, 2020

https://github.com/LesterLyu/fast-formula-parser/blob/master/grammar/hooks.js#L107

Right now, onVariable callbacks has access to variable name and sheet, but not the cell position.

Can i propose to change

const res = {ref: this.onVariable(name, this.position.sheet)};

to

const res = {ref: this.onVariable(name, this.position)};

The reason is that lets say i have a formula =sales * 10, in a table. For each onVariable call, i want to access the cell position and return the correct position of sales column.

Eg:

Sales total
11 =sales * 10
12 =sales * 10
@LesterLyu
Copy link
Owner

Is this achievable in Excel or Google Sheets?

@rmdort
Copy link
Contributor Author

rmdort commented Nov 22, 2020

In Excel tables, it is supported

https://support.microsoft.com/en-us/office/using-structured-references-with-excel-tables-f5ed2452-2337-4f71-bed3-c8ae6d2b276e

@rmdort
Copy link
Contributor Author

rmdort commented Nov 26, 2020

What do you think of this? Is there any otherway u propose I can access a row index of a variable cell?

@LesterLyu
Copy link
Owner

LesterLyu commented Nov 26, 2020

I'm not familiar with the structured reference, I think I will just make position the third parameter.
In the next v2 update, I will then move it to the second parameter.

@rmdort
Copy link
Contributor Author

rmdort commented Nov 26, 2020

Cool thanks. Will be helpful.

@rmdort
Copy link
Contributor Author

rmdort commented Dec 4, 2020

Any ETA on v2 release?

@LesterLyu
Copy link
Owner

Not sure yet, could be the beginning of 2021, or the end of 2020.

@rmdort
Copy link
Contributor Author

rmdort commented Dec 15, 2020

Wondering if there is a way to access Table names as well =SUM(DeptSales[Sales Amount])

DeptSales => Table and Sales Amount => column name

More info - https://support.microsoft.com/en-us/office/using-structured-references-with-excel-tables-f5ed2452-2337-4f71-bed3-c8ae6d2b276e

@LesterLyu
Copy link
Owner

Implemented in the v2 branch, position is now the second parameter.

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