---
title: "parse_formula_refs"
---

[< Back to Reference](../reference.qmd) | [View source](https://codeberg.org/usrbinr/tidychain/src/branch/main/R/extract_formulas.R#L78)

# `parse_formula_refs()`

Parse Cell References from a Formula

## Usage

```r
parse_formula_refs(formula, current_sheet = NULL)
```

## Arguments

| Argument | Description |
|----------|-------------|
| `formula` | An Excel formula string (without the leading =). |
| `current_sheet` | Optional sheet name to prefix local references. |

## Value

A character vector of cell references found in the formula.
If `current_sheet` is provided, local references are prefixed (e.g., "Sheet1!A1").

## Description

Extracts all cell references from an Excel formula string.

## Examples

```r
parse_formula_refs("A1+B1")
#> [1] "A1" "B1"

parse_formula_refs("SUM(A1:A10)")
#> [1] "A1" "A10"

parse_formula_refs("Sheet2!A1+B1", current_sheet = "Sheet1")
#> [1] "Sheet2!A1" "Sheet1!B1"
```

