+ Reply to Thread
Results 1 to 2 of 2

Working out the number of items in =1+2+3+4

  1. #1
    Registered User
    Join Date
    10-05-2006
    Posts
    1

    Working out the number of items in =1+2+3+4

    Hi all,

    I'm new to Excel and I don't know that much about it. I do know a little about VBA and am a programmer so I can make sense of stuff pretty easily.

    I'm stuck though trying to find a way to look at an excel cell with something in it link: =12.68+6.74+4.54+4.4
    Then I want to be able to find out how many numbers are being added together (in this example 4) so that I can then work out what the average number is.

    It's important to me as I want to use this on my income tracking spreadsheet so I can see how many orders have been placed and what the average value is each day.

    Any thoughts? Am I barking up the wrong tree here?

    Mike

  2. #2
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394
    Don't know which tree you are barking up, but an easy way to do this in a formula is to count the + and add 1.

    The vba code could do something like this to create a custom function

    Function CountPlus(mySelection As Range)
    myCount = 0
    For x = 1 To Len(mySelection.Formula)
    If Mid(mySelection.Formula, x, 1) = "+" Then myCount = myCount + 1
    Next x
    CountPlus = myCount + 1
    End Function

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1