View Single Post
  #8   Report Post  
Lambtwo
 
Posts: n/a
Default Counting number of items being added in a formula

Thanks for your help.

Please excuse my ignorance .... how do I set a function up in my file?


"Bob Phillips" wrote in message
...
Here is a simple function

Function CountList(rng As Range, Optional delimiter As String = "+")
Dim arg
If rng.Count 1 Then
CountList = CVErr(xlErrRef)
Else
arg = Split(rng.Formula, delimiter)
CountList = UBound(arg) - LBound(arg) + 1
End If
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"ScottO" wrote in message
...
I'm sorry but I can't think of a formula way of doing this. Perhaps
one of the 'more able' regular posters will find a way.
I'm sure that it could be done by writing a function, but I can't
help you with that.
Depending on what the rest of your spreadsheet looks like, a
workaround would be to switch the 'Move selection after Enter'
setting to "Down", then enter all the item prices down columnA, then
put =SUM(A:A) in B1, and =Count(A:A) in B2. Pretty lame I know, but
it would get the job done if you don't get a better offer.
If layout matters, you could hide all that ugly stuff on another tab,
and just reference the B1 & B2 cells onto your output tab.
If all the entries are down columnA, when its time for the next
transaction, just select the whole of ColA and hit delete.
HTH,
ScottO


"Lambtwo" wrote in message
news:0Oi9f.360842$oW2.198240@pd7tw1no...
| This is for a retail sale where we are trying to count the number
of items
| sold. Each item sold is input directly into A1. Example, if 28
items were
| sold, then A1 would have the sale prices like =3.00+7.25+5.50, etc
..... We
| want to have the count of items sold (28) based on the entry in A1
to appear
| in B1.
|
|
| "ScottO" wrote in
message
| ...
| It's going to depend a lot on the exact formula that you're using
to
| add the numbers.
| Can you show an example of the formula please?
| If there is more than one possible formula style, then please
show an
| example of each style.
| Rgds,
| ScottO
|
| "Lambtwo" wrote in message
| news:K5i9f.370924$tl2.237458@pd7tw3no...
| | I want to count the number of items that are being added
together
| in a cell.
| |
| | For example if A1 had =3+5+7, A1 would sum to 15 and I would
want
| B1 to show
| | 3 for the number of items being added.
| |
| | What is the best way to capture this?
| |
| |
| |
| |
|
|
|
|