What I need to do is sum all the unique values of an excel file. But said excel file is generated within the script from a number of operations on different text files. What I need to do is in put the following formula in to a cell as an array (In excel that means you have to hit ctrl+shift+enter to set the cell up to calculate correctly.)
=SUM(IF(FREQUENCY(IF(LEN(A2:A500)>0,MATCH(A2:A500,A2:A500,0),""), IF(LEN(A2:A500)>0,MATCH(A2:A500,A2:A500,0),""))>0,1))
After pressing the needed key combination excel adds a {} around the entire formula to designate it as an array however just adding this in to the formula does not work when using XLSetCell command.
I would prefer not to use the keyboard to interact onscreen with the excel sheet if it can be avoided.
Surely there is someone much smarter than myself out there and has needed to do this before. Thanks for all the help guys.
Below is the code I am using to input the cell too BTW.
Code: Select all
//Display Number of Orders
Let>CountOrders==SUM(IF(FREQUENCY(IF(LEN(A2:A500)>0,MATCH(A2:A500,A2:A500,0),""), IF(LEN(A2:A500)>0,MATCH(A2:A500,A2:A500,0),""))>0,1))
XLSetCell>xlBook,%filename_without_extension%,1,74,CountOrders,Result6
XLSave>xlBook,S:\Amazon Sales Sheets\Raw\%filename_without_extension%\%filename_without_extension%.xls
XLGetCell>xlBook,%filename_without_extension%,1,74,CountOrders,Result6
MessageModal>%CountOrders%