ISREF


Tests if the argument is a reference to a cell or range of cells.

Syntax:

ISREF(value)

Returns TRUE if value is a reference to a cell or range of cells and FALSE otherwise.

Example:

ISREF(C5)

returns TRUE, because C5 refers to a cell.

ISREF(A1:B3)

returns TRUE, because A1:B3 refers to a range of cells.

ISREF("A5")

returns FALSE, because "A5" is text, not a cell reference.

ISREF(NA())

returns FALSE, because NA() is an error, not a cell reference.

ISREF(A9999999)

returns FALSE, because cell A9999999 does not exist.

ISREF(range1)

where range1 is the named range A1:B3, returns TRUE.

ISREF(range2)

where range2 is not defined, returns the #NAME? error

ISREF(INDIRECT(C1))

where cell C1 contains the text "D1", returns TRUE, because INDIRECT returns a reference.


Application:

A good application of ISREF is in a validation or error-checking formula. Imagine you have a spreadsheet for a simple inventory system where a user needs to enter either the quantity of an item or a reference to a cell containing the quantity. You want to make sure the input is correct and provide a helpful message if it's not.


Here's a table-based example:

Inventory Tracking Sheet

Item

Quantity

Valid Input?

Notes

A
B
C
D
1
Apples
100
TRUE
User entered a number
2
Oranges
50
TRUE
User entered a number
3
Grapes
N/A
FALSE
User entered a text string
4
Bananas
#REF!
FALSE
User entered a reference to a deleted cell

The result will be:

  • C1: TRUE (because B1 is a number)
  • C2: TRUE (because B2 is a number)
  • C3: FALSE (because B3 is text)
  • C4: TRUE (because B4 is an error reference, which ISREF correctly identifies as a reference)


This example demonstrates how ISREF can be used to validate if an input is a reference, even if that reference is broken. In this case, ISREF is not needed for the first two rows but is essential for correctly validating the input in row 4.





This page is protected by Google reCAPTCHA. Privacy - Terms.
 
Built using Zapof