Really appreciate the AHK forums...many topics have helped me over the last few years. This is my first post: hoping someone can assist.
I need to catalogue data in Excel and be able (in an AHK script) to search multiple columns very quickly to find matching rows that match on all of several columns.
Here's my problem: inside of Excel itself, I can use the Index-Match functions to get it done. Works perfectly. However, I cannot find any way to write this same command in AHK and make it come up with the same (correct answer).
For example: this Excel formula (when run in Excel itself) finds row 27 as the row with 'rehab' in column A and 'pain' in column B:
=MATCH("rehab"&"pain",A:A&B:B,0)
Here are my multiple attempts in AHK to write the same function: NONE give the correct answer:
Code: Select all
XL := ComObjActive("Excel.Application")
; msgbox % xl.match("rehab"&"pain",xl.range("A:A"&"B:B")) ; Way off
; msgbox % xl.match("rehab"&"pain",(xl.range("A:A")&xl.range("B:B"))) ; way off
; msgbox % xl.match("rehab"&"pain",xl.range("A:A")&xl.range("B:B")) ; way off
; msgbox % xl.match("rehab"&"pain",xl.range("A1:A100")&xl.range("B1:B100")) ; way off
; msgbox % xl.match("rehab"&"pain",xl.range("A:A&B:B"),0) ; range error
; msgbox % xl.match("rehab"&"pain",xl.range("A:A"&"B:B"),0) ; returns 23 when correct should be 27
; msgbox % xl.match("surg"&"urology",xl.range("A:A"&"B:B"),0) ; returns 9 when correct is 11
[Mod actions: Move topic from “About This Community.” Added [code][/code] tags. Please use them yourself when posting code.]