https://i.sstatic.net/frSmYl6t.png
I want to find which district's vol is 580,to ype "=INDEX(A2:A3,MATCH(580,B2:B3,0))" in B6 can get it.
And i can get the district name with below code:
Code: Select all
sub call_nested_calc()
oFunAccess = createUnoService( "com.sun.star.sheet.FunctionAccess" )
oDoc = ThisComponent
oSheet = oDoc.sheets.getByName("Sheet15")
with oSheet
a_Range = .getCellRangeByName("a2:a3")
b_Range = .getCellRangeByName("b2:b3")
end with
with oFunAccess
district = .CallFunction( "index",array( a_Range, .CallFunction("match", array(580, b_Range, 0))))
end with
print district
end sub