ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Searching TEXT in formulae, rather than results of formulae (https://www.excelbanter.com/excel-worksheet-functions/35498-searching-text-formulae-rather-than-results-formulae.html)

AndyE

Searching TEXT in formulae, rather than results of formulae
 
Is there any way to use the "=RIGHT" or "=LEFT" functions to search the text
that makes up a formula, rather than the result of the formula?

I have a list of formulae that reference a sequence of cells, and I need to
check that the sequence isn't broken (I'm going to ask it to check that each
cell reference is one away from the previous reference, and return an error
message if it isn't).

Thanks!

Niek Otten

You can use this UDF:

Function ShowFormula(a As Range)
If Application.ReferenceStyle = xlR1C1 _
Then ShowFormula = a.FormulaR1C1 _
Else: ShowFormula = a.Formula
End Function

You may benefit from (temporarily) choosing R1C1 reference style
(ToolsOptions, General tab). If for example you always reference the row
above or the column to the left, the formulas are the same and exeptions are
easily detected.

--
Kind regards,

Niek Otten

Microsoft MVP - Excel

"AndyE" wrote in message
...
Is there any way to use the "=RIGHT" or "=LEFT" functions to search the
text
that makes up a formula, rather than the result of the formula?

I have a list of formulae that reference a sequence of cells, and I need
to
check that the sequence isn't broken (I'm going to ask it to check that
each
cell reference is one away from the previous reference, and return an
error
message if it isn't).

Thanks!





All times are GMT +1. The time now is 05:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com