ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Need Help in counting + sign in a cell (https://www.excelbanter.com/excel-worksheet-functions/160774-need-help-counting-sign-cell.html)

[email protected]

Need Help in counting + sign in a cell
 
I am entering the following in a cell: =5+8+60+1

Now I would like to do two things:
1. I would like to count number of numerical terms in this entry
(e.g. 4 in the above example). Is there any way of counting + sign in
cell and showing the result in a different cell?

2. I would like to see the content of the above cell as is (i.e.,
=5+8+60+1) in another cell of a different worksheet of a workbook.

-Peter


Gary''s Student

Need Help in counting + sign in a cell
 
This small UDF will return the number of plus signs in a formula:

Function count_plus(r As Range) As Integer
v = r.Formula
count_plus = Len(v) - Len(Replace(v, "+", ""))
End Function

This small UDF will display a function as a string:

Function formularity(r As Range) As String
formularity = r.Formula
End Function

--
Gary''s Student - gsnu2007


" wrote:

I am entering the following in a cell: =5+8+60+1

Now I would like to do two things:
1. I would like to count number of numerical terms in this entry
(e.g. 4 in the above example). Is there any way of counting + sign in
cell and showing the result in a different cell?

2. I would like to see the content of the above cell as is (i.e.,
=5+8+60+1) in another cell of a different worksheet of a workbook.

-Peter




All times are GMT +1. The time now is 07:01 AM.

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