Skip to content

OFFSET() returns #REF! if height and width are omitted #561

@martinf55

Description

@martinf55

This is:

- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

Optional width and height as in =OFFSET(range, 0, 2) should be supported as documented.

What is the current behavior?

#REF! is returned because the function is validating that the new $pCell argument is present. It is present, but it has been passed in the $height position.

Before commit [8dddf56] the $pCell was popped off the end of the argument list, this behaviour should be retained.

What are the steps to reproduce?

Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:

<?php

require __DIR__ . '/vendor/autoload.php';

// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

// add code that show the issue here...

Which versions of PhpSpreadsheet and PHP are affected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions