A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hello Rahima,
I'm Ibhadighi and I'd happily help you with your question. In this forum, we are Microsoft consumers just like yourself.
The issue with your script causing all rows to match row 1798 arises from the last part of your code, where you're copying formulas from row 1798 to the rest of the rows in your range (C1798:H1930). This action overrides the individual XLOOKUP formulas you set up in the loop with the formula from row 1798, hence causing all rows to match row 1798.
To fix this, you simply need to remove or comment out the following line from your script:
sheet1.getRange(C1798:H1930).copyFrom(sheet1.getRange(C1798:H1798), ExcelScript.RangeCopyType.formulas);
This line is not needed because your loop already sets the correct formula for each row individually. Once removed, your script should correctly apply the unique XLOOKUP formula to each row from 1798 to 1930, referencing the appropriate cells in Sheet1 and Prisma without causing all rows to match the data from row 1798.
I hope this helps.
Best Regards, Ibhadighi