from openpyxl import Workbook
wb = Workbook()
ws = wb.create_sheet("Summary")
ws.cell(5,8).value = f'=PERCENTILE({ws.min_row}:{ws.max_row}, {ws.cell(6,6)})
So i want the formula to be dynamic. dynamic in the sense that the value results from this formula should change when the cell(6,6) value is changed just like it happen in excel but here in this case the cell is set with "=PERCENTILE(B2:B42, <Cell 'Summary'.F6>)" where it's just a string.
CodePudding user response:
You've passed the object wherein what you need is the coordinate (cell reference).
ws.cell(5,8).value = f'=PERCENTILE({ws.min_row}:{ws.max_row}, {ws.cell(6,6).coordinate})'
ws.cell has an attribute "coordinate".