Describe the bug
The INDEX() function does not behave like in Excel, specifically for the case where col = 0 i.e. when it should take the full column. Summing over an INDEX() goes wrong.
To Reproduce
# Excel file 'python_formulas_index_bug.xlsx' as below (sheet name: Sheet1)
# A B C
#1 1 4 7
#2 2 5 8
#3 3 6 9
# E2 = 2
# E3 =SUM(INDEX(A2:C4;0;E2))
# Instruction:
# Compile a python formulas function with E2 as input and E3 as output
# Excel returns E3 value = 15, i.e. the sum of the 2nd column in the A2:C4 range, as expected. Formulas returns 4 = the first value in the (correct) column of the range. This is incorrect.
# Code to reproduce error
import formulas
filepath = 'python_formulas_index_bug.xlsx'
xl_model = formulas.ExcelModel().loads(filepath).finish()
excel_inputs = ["'[python_formulas_index_bug.xlsx]SHEET1'!E2"]
excel_outputs = ["'[python_formulas_index_bug.xlsx]SHEET1'!E3"]
func = xl_model.compile(inputs = excel_inputs, outputs = excel_outputs)
func(2) # Expected 15, get 4
Desktop (please complete the following information):
OS: macOS
Version 14.2.1 (23C71)
Additional context
Hey! Formulas is an awesome library. I was looking at the INDEX() implementation to see if I could figure out the problem, but I didn't get anywhere. Really appreciate your work, thank you! Sincerely /Christoffer Jevring
Describe the bug The INDEX() function does not behave like in Excel, specifically for the case where col = 0 i.e. when it should take the full column. Summing over an INDEX() goes wrong.
To Reproduce
Desktop (please complete the following information):
Additional context Hey! Formulas is an awesome library. I was looking at the INDEX() implementation to see if I could figure out the problem, but I didn't get anywhere. Really appreciate your work, thank you! Sincerely /Christoffer Jevring