View Single Post
  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way, using a UDF:

Public Function NumTrips(rng As Excel.Range) As Variant
With rng
If Not .HasFormula Then
NumTrips = 0 ' or CVErr(xlErrRef)
Else
NumTrips = Len(.Formula) - _
Len(Application.Substitute(.Formula, "(", ""))
End If
End With
End Function


If you're unfamiliar with UDFs, see

http://www.mvps.org/dmcritchie/excel/getstarted.htm



In article ,
paper cutter <paper wrote:

I am reviewing vehicle usage. An example of a formula under review is as
follows: =(5-2)+(6-2)+(8-3). This will add up the kilometers. The 2nd
column (the problem), I want to calculate is the number of trips. Each
bracket is considered one trip. In the above example that would be a total
of 3 trips and total of 12 km.