<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Inpredictable behaviour in a more complex lookup and address processing formula"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=107724">107724</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Inpredictable behaviour in a more complex lookup and address processing formula
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.3.2.2 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Calc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>m.p.de.graaff@infsec.nl
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Description:
Combination of various nested MATCH, INDIRECT, ADDRESS functions behaves
inpredictably, whilst working correctly when splitting the formula over two
cells.
Only malbehaves in LibreOffice and under various OS'ses. Behaves *correctly* in
MS-Office using xslx exports, and also behaves *correctly* in OpenOffice using
the original .ods file.

Steps to Reproduce:
I did prepare a sheet showing the problem and a correct working workaround
using two cells with split functionality (URL:
<a href="https://www.mpxf.nl/data/bugs/LibreOffice%205.3.2.2%20Bug.zip">https://www.mpxf.nl/data/bugs/LibreOffice%205.3.2.2%20Bug.zip</a>)

Basically the looks up the two occurences (assumed to be present) in a list
named RoleAssignment for a given entry in a table named Role. Occ#1 is lookedup
using MATCH(), whereas Occ#2 is also searched for using MATCH, but starting
just after Occ#1 by restricting the address range within the table
RoleAssignment

formula (bad behaving):
=MATCH($E4;INDIRECT(ADDRESS(ROW(RoleAssignment)+$G4;COLUMN(RoleAssignment))&":"&ADDRESS(ROW(RoleAssignment)+ROWS(RoleAssignment)-1;COLUMN(RoleAssignment)));0)+$G4

split formula (well behaving):
(1st step)
=ADDRESS(ROW(RoleAssignment)+G4;COLUMN(RoleAssignment)) & ":" &
ADDRESS(ROW(RoleAssignment)+ROWS(RoleAssignment)-1;COLUMN(RoleAssignment))
(2nd step)
=MATCH($E4;INDIRECT($I4);0)+$G4

Actual Results:  
#N/A
#N/A
8
8
6

Expected Results:
3
6
10
8
9


Reproducible: Always

User Profile Reset: No, but I used various computers and OS'ses (WINXP-SP3,
WIN10, Linux SUSE Leap 42.2)

Additional Info:
Note the link above (under "Steps to reproduce") to the prepared test
spreadsheet showing the malbehaviour and a screenshot of the result on my
systems


User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101
Firefox/53.0</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>