View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default data find and add for summary

Dim rng as Range, s as String, s1 as String, s2 as String
set rng = Range(Cells(2,1),Cells(rows.count,1).End(xlup))
s = "total nmber: " & rng.count
s1 = "too long: " & application.countif(rng.offset(0,2),"*long*")
s2 = "too short: " & application.countif(rng.offset(0,2),"*short*")

msgbox s & vbNewline & s1 & vbNewline & s2

--
Regards,
Tom Ogilvy

"TommySzalapski"
<TommySzalapski.1t5fb6_1123006014.0442@excelforu m-nospam.com wrote in
message news:TommySzalapski.1t5fb6_1123006014.0442@excelfo rum-nospam.com...

I have some data that looks something like this

Qty.......Qty Bad...Reason
34........2.........too long
45........0
44........4.........too short
54........3.........too long

I need to (in a macro) build a summary like
total number 177
too long 5
too short 4

I have a few ideas (for each row, if there is a reason, see if the
reason is in the summary yet and add it if not and add the
corresponding number to the running total)
I started coding this up and it looks messy and complicated and slow.
I can do it this way, but if someone feels like showing off his Excel
prowess and helping me out by giving me some ideas, I would appreciate
it.

thanks,
Tommy


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile:

http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=392256