Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help adding 5,400+ rows of time data

I finally have access to the full report (5,400+ rows of data). Most o
the data is unimportant to me except for "Column D". Each cell i
column D is in the following format...

Column D
0H:8M
9H:39M
14H:46M ... and so on.

So all these cells are formatted as [hh]"H":mm"M
(Format=Cells=Number tab=Custom)

Adding these cells is "no problem". The obstacle is that there are
different color cells within column D. I was able to get the exact RG
shade or color (I don't know if this could help).

Color.........R.....G.....B
Green.....204...255..204
Yellow....255...255..153
Red........255...128..128

What I want to accomplish is the following:
Select a range in column D of... let's say 200 rows and have code..
using something like an input box

'...Thanks Tom O
On error resume next
set rng = Application.InputBox( _
"Please select range with mouse", type:=8)
On Error goto 0
if not rng is nothing then

Add total time for Green, Yellow and Red cells... which brings anothe
factor to this whole operation... as time exceeds 24 hours Days ar
created. Therefore, adding 200 rows for example might yield a tota
green cells 4D:14H:46M... Its the 4D (D=days) that I didnt take int
consideration.


I would really be gratefull beyong belief, if anyone can come up with
solution.


Larry
VBA Amateu

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help adding 5,400+ rows of time data

Thinking things tru... you can forget about the D=days factor... I thin
anyone can understand 147H:49M perfectly.

Larry
VBA Amateu

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help adding 5,400+ rows of time data

Sub CalculateTime()
Range("D1:D200").Select
Selection.NumberFormat = "[h]""H"":mm""M"";@"
Range("D201").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-200]C:R[-1]C)"
Range("D202").Select
End Sub

This little macro adds range D1:D200 but I have no idea how to add th
color cells (green, yellow, red) separatelly

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help adding 5,400+ rows of time data

Found this on Chip Pearson's site...


Summing The Values Of Cells With A Specific Color

The following function will return the sum of cells in a range tha
have either an Interior (background) or Font of a specified color.
InRange is the range of cells to examine, WhatColorIndex is th
ColorIndex value to count, and OfText indicates whether to return th
ColorIndex of the Font (if True) or the Interior (if False).
Function SumByColor(InRange As Range, WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Double
'
' This function return the SUM of the values of cells in
' InRange with a background color, or if OfText is True a
' font color, equal to WhatColorIndex.
'
Dim Rng As Range
Dim OK As Boolean

Application.Volatile True
For Each Rng In InRange.Cells
If OfText = True Then
OK = (Rng.Font.ColorIndex = WhatColorIndex)
Else
OK = (Rng.Interior.ColorIndex = WhatColorIndex)
End If
If OK And IsNumeric(Rng.Value) Then
SumByColor = SumByColor + Rng.Value
End If
Next Rng

End Function
You can call this function from a worksheet cell with a formula like
=SUMBYCOLOR(A1:A10,3,FALSE)


How do I integrate this with my code? can any1 help?? :(


Larry
VBA Amateu

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help adding 5,400+ rows of time data

Column D
0H:8M
9H:39M
14H:46M ... and so on.

these cells DO NOT have any format. I wish to add the values before th
"H" and the values before the "M" and still have them separated by th
":".

for example...
Column D
0H:8M
9H:39M
----------
Total
9H:47M

To complicate things even more,... there are 3 different color cell
within column D. Below you'll see each color property (I don't know i
this could help).

Color.........R.....G.....B
Green.....204...255..204
Yellow....255...255..153
Red........255...128..128

What I want to accomplish is the following:
Select a range in column D of... let's say 200 rows and have code..
using something like an input box add total time for Green, Yellow an
Red cells... Therefore, adding 200 rows for example might yield a tota
green cells 450H:46M.

The following could be a beginning... for selecting range using a
input box.

'...Thanks Tom O
On error resume next
set rng = Application.InputBox( _
"Please select range with mouse", type:=8)
On Error goto 0
if not rng is nothing then

Also, I Found this on Chip Pearson's site...

Summing The Values Of Cells With A Specific Color

The following function will return the sum of cells in a range tha
have either an Interior (background) or Font of a specified color
InRange is the range of cells to examine, WhatColorIndex is th
ColorIndex value to count, and OfText indicates whether to return th
ColorIndex of the Font (if True) or the Interior (if False).
Function SumByColor(InRange As Range, WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Double
'
' This function return the SUM of the values of cells in
' InRange with a background color, or if OfText is True a
' font color, equal to WhatColorIndex.
'
Dim Rng As Range
Dim OK As Boolean

Application.Volatile True
For Each Rng In InRange.Cells
If OfText = True Then
OK = (Rng.Font.ColorIndex = WhatColorIndex)
Else
OK = (Rng.Interior.ColorIndex = WhatColorIndex)
End If
If OK And IsNumeric(Rng.Value) Then
SumByColor = SumByColor + Rng.Value
End If
Next Rng

End Function
You can call this function from a worksheet cell with a formula like
=SUMBYCOLOR(A1:A10,3,FALSE)


How do I integrate these codes together? can any1 help??

I would really be gratefull beyong belief, if anyone can come up with
solution.


Larry
VBA Amateu

--
Message posted from http://www.ExcelForum.com



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro from columns to rows but adding every time a new line [email protected] Excel Discussion (Misc queries) 2 December 7th 08 08:59 PM
Adding multiple data fields from time based data. JMK Excel Discussion (Misc queries) 1 July 27th 07 10:59 PM
Adding time data Terry Bennett Excel Worksheet Functions 2 October 18th 06 07:14 PM
Adding data from multiple rows PCStechnical Excel Discussion (Misc queries) 2 October 11th 06 04:45 PM
How do i keep a running balance without adding rows each time? park Excel Worksheet Functions 1 August 14th 05 10:37 AM


All times are GMT +1. The time now is 08:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"