0

Does anybody know of a way to organize a binary search in LibreOffice Calc?

To take a simple example, say I have column A with the numbers 1-16 listed, sorted in ascending order: (1,2,3,...); and column B which lists names of widgets; and I want to find a given widget by searching the numbers in column A. Simple enough: =SEARCH(number;A1:A16;B1:B16). But suppose my list contains 1600 numbers, sorted, and I need the widget name associated with entry 992. 'Search' would have to go through 992 iterations to reach the desired value. A binary search, a la java, would cut that down to maybe 10 iterations. But can that be done?

As nearly as I can tell, each cell in a spreadsheet is fundamentally independent of all the others, and even organizing a binary search "tree" within a group of cells, Calc would want to go through every cell and calculate its value based on whatever formula the given cell contains - even if the cell is extraneous to the search thread.

SO: is a binary search possible?

  • You might get an answer here, but Superuser.com is certainly a better place to ask (if for no other reason than LO isn't specific to Linux). – RonJohn Apr 17 '23 at 20:50

0 Answers0