Excel: Using Noncontiguous Ranges in Array Functions

Last reviewed: February 18, 1998
Article ID: Q79625

The information in this article applies to:
  • Microsoft Excel 97 for Windows
  • Microsoft Excel version 7.0 for Windows 95
  • Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 5.0
  • Microsoft Excel for OS/2, versions 2.2, 2.21, 3.0

SUMMARY

Microsoft Excel functions that take arrays as arguments, such as LINEST, LOGEST, IRR, MIRR, MDETERM, NPV, RATE, and XIRR cannot accept noncontiguous ranges of data as their array arguments. You must either copy the ranges to a contiguous area or enter the values as constants, as the following two workarounds describe.

WORKAROUNDS

The example below shows how to use these workarounds with the LINEST function.

Example

LINEST uses regression analysis to estimate a straight line to fit known data. Here the known_x's are in a noncontiguous range:

   A1: X1          B1:     C1: X3       D1: Y1
   A2: 2,310       B2:     C2: 20       D2: 142,000
   A3: 2,333       B3:     C3: 12       D3: 144,000

Workaround 1

Copy the data so it is in a contiguous area of the worksheet and enter the data as a contiguous range reference. For example, copy the data in columns A and C into columns E and F and enter the following formula in cell A5 as an array (CTRL+SHIFT+ENTER):

   =LINEST(D2:D3,E2:F3,,TRUE)

Workaround 2

Enter the data values into the function as array constants, rather than using a range reference. For example, enter the following formula in cell A5 as an array (CTRL+SHIFT+ENTER):

   =LINEST(D2:D3,{2310,20;2333,12},,TRUE)

REFERENCES

"Function Reference," version 4.0, pages 254-258

"User's Guide 2," version 4.0, pages 159-161

"Microsoft Excel Function Reference," version 3.0, pages 138-141

"Microsoft Excel User's Guide," version 3.0, pages 282-284


Additional query words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0
3.00 4.0 4.00 non-contiguous contiguous 5.0
Version : WINDOWS:2.2,3.0,4.0,5.0,7.0,97; MACINTOSH:2.0,3.0,4.0,5.0
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 18, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.