-
Notifications
You must be signed in to change notification settings - Fork 29
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
Absolute references broken (i.e. references with $-signs like $A$1) #42
Comments
@ckp95 Are you able to contribute your code for base conversion functions? |
Oh goodness, I completely forgot about this. Yes I'll fix up what I've got and do a pull request in the next few days. |
That would be very much appreciated. I've been really looking forward to supporting those functions. PyCel and Formulas support them all and it's the only function category we don't have any coverage at all. In terms of absolute references... Did you try something like this? In any case intentionally handling the Are you comfortable if they get stripped from the address? My figuring is the absolute cell reference is designed to help when filling and moving cells. That doesn't mean much when the formula has been translated to Python. It could "break" the in-person usability of the workbook if we write out a workbook (save a model to an .xlsx) and the absolute references had been dropped. But that's not currently a supported use case. I had thought it might be a nice feature. |
I don't have much of an opinion on how reference-style should get handled when writing back out to .xlsx, since at the moment that's not really my use case. If pressed I would try to reduce the round-trip information loss, since that's the minimum-surprise thing to do. As for the base functions, I'm a bit busy this week but I can try to get something on the weekend. I actually did quite a bit more than just those functions. I kept running into weird edge cases where the naive implementation disagreed with how Excel did it (and also differences between LibreOffice and Excel), so I threw up my hands and started using |
I have not forgotten about this. |
Okay the base conversion functions are implemented in this PR #49 |
Is there a workaround until this gets fixed? As it is, xlcalculator is basically unusable if absolute referencing is used anywhere...
Simply stripping every single $ would probably work, but I don't know how I would do that. |
Any update on this feature? Any pointers @ckp95 ? |
I tried stripping the $ from the formulas and it didn't work :/
The formula in H1227 is =H1175/(H$1061)*1000 The output of the above is:
|
I solved by replacing the $ before creating the model. Test.xlsx is a simple Excel file where B1=5 and B2=2*B1. Using the file Test_mod.xlsx (created by replacing the all the $ in the formulas with xlwings), the output is correct.
The output is:
Anyway, it would be nice if someone can fix this issue without using this workaround. |
is this issue fixed ? |
The evaluator does not know what to do with formulae that have absolute references like
$A$1
.Using this file which simply adds two cells together but varies the referencing style:
absolute_references_test.xlsx
Result is
I ran into this problem while working on implementing the base conversion functions (
DEC2BIN
,OCT2HEX
etc) and I couldn't figure out why it would fail when I ran it on a test file -- turns out my implementation was fine but I had used absolute references in some of the test case formulae.The text was updated successfully, but these errors were encountered: