PreviousCell
✖
PreviousCell
Details and Options

- The evaluation of PreviousCell will not result in the selection or insertion point's changing position.
- If the requested cell is not available or the top of the notebook is reached, PreviousCell will return None.
- PreviousCell can return the first cell before the reference point that matches given criteria by specifying one or more of the following options:
-
CellID cell IDs to match CellLabel In/Out label strings to match CellStyle named cell styles to match CellTags cell tags to match Evaluator cells that match the specified evaluator GeneratedCell match only generated output cells if True, or only non-generated cells if False - PreviousCell[cellobj] of an inline cell will return the previous inline cell in the same cell. PreviousCell[NotebookSelection[nbobj]] will always return the previous regular cell, regardless of whether an inline cell is presently selected.
Examples
Basic Examples (3)Summary of the most common use cases
Get the CellObject for the previous cell:
In[1]:=1

✖
https://wolfram.com/xid/0enyoc352-pxboqg
Out[1]=1

Read this caption cell into the kernel:
In[1]:=1

✖
https://wolfram.com/xid/0enyoc352-jtcoiy
Out[1]=1

There are no "Section" style cells above this point in this notebook:
In[1]:=1

✖
https://wolfram.com/xid/0enyoc352-y6zgjy
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0enyoc352-c8hycb
Out[2]=2

Wolfram Research (2014), PreviousCell, Wolfram Language function, https://reference.wolfram.com/language/ref/PreviousCell.html (updated 2020).
✖
Wolfram Research (2014), PreviousCell, Wolfram Language function, https://reference.wolfram.com/language/ref/PreviousCell.html (updated 2020).
Text
Wolfram Research (2014), PreviousCell, Wolfram Language function, https://reference.wolfram.com/language/ref/PreviousCell.html (updated 2020).
✖
Wolfram Research (2014), PreviousCell, Wolfram Language function, https://reference.wolfram.com/language/ref/PreviousCell.html (updated 2020).
CMS
Wolfram Language. 2014. "PreviousCell." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/PreviousCell.html.
✖
Wolfram Language. 2014. "PreviousCell." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/PreviousCell.html.
APA
Wolfram Language. (2014). PreviousCell. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PreviousCell.html
✖
Wolfram Language. (2014). PreviousCell. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PreviousCell.html
BibTeX
✖
@misc{reference.wolfram_2025_previouscell, author="Wolfram Research", title="{PreviousCell}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/PreviousCell.html}", note=[Accessed: 27-April-2025
]}
BibLaTeX
✖
@online{reference.wolfram_2025_previouscell, organization={Wolfram Research}, title={PreviousCell}, year={2020}, url={https://reference.wolfram.com/language/ref/PreviousCell.html}, note=[Accessed: 27-April-2025
]}