Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / July 2004

Tip: Looking for answers? Try searching our database.

Need to add cells from column B to create new total in column D

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Erikka T - 13 Jul 2004 18:44 GMT
This must be elementary, but I am new to VBA. I have a SQL query that returns data to my sheet that is grouped by status, and ordered by date. Here is an example of what is returned:
9/27/2003 17:00    1    Open-Propose
9/27/2003 17:00    1    Open-Review
9/27/2003 17:00    31    Open
10/4/2003 17:00    2    Open-Review
10/4/2003 17:00    38    Open
10/4/2003 17:00    4    Open-Propose

I need to create a chart so that for each given date, a total of all "Open*" is presented, because for charting purposes it doesn't matter what the status is, the overall count is what is important.

I want this returned:

9/27/2003 17:00    33
10/4/2003 17:00    44

I would like to write something that selects the sheet, and then compares the date cell to the next date cell and then total up all the numbers for that same date, and stick it in a new column so that I can chart it.

I suppose I could use a command button, but it would be better if the function could just run if the data on the sheet is changed.

Thanks!
Frank Kabel - 13 Jul 2004 18:48 GMT
Hi
a non-VBA solution: Use a pivot table for this. See:
http://www.cpearson.com/excel/pivots.htm
http://peltiertech.com/Excel/Pivots/pivotstart.htm
http://www.contextures.com/xlPivot02.html
http://www.ozgrid.com/Excel/excel-pivot-tables.htm

Signature

--
Regards
Frank Kabel
Frankfurt, Germany


> This must be elementary, but I am new to VBA. I have a SQL query that
> returns data to my sheet that is grouped by status, and ordered by
[quoted text clipped - 22 lines]
>
> Thanks!
CLR - 14 Jul 2004 01:05 GMT
I would use the Data > Subtotals feature..........

Vaya con Dios,
Chuck, CABGx3

> This must be elementary, but I am new to VBA. I have a SQL query that returns data to my sheet that is grouped by status, and ordered by date.
Here is an example of what is returned:
> 9/27/2003 17:00 1 Open-Propose
> 9/27/2003 17:00 1 Open-Review
[quoted text clipped - 4 lines]
>
> I need to create a chart so that for each given date, a total of all "Open*" is presented, because for charting purposes it doesn't matter what
the status is, the overall count is what is important.

> I want this returned:
>
> 9/27/2003 17:00 33
> 10/4/2003 17:00 44
>
> I would like to write something that selects the sheet, and then compares the date cell to the next date cell and then total up all the numbers for
that same date, and stick it in a new column so that I can chart it.

> I suppose I could use a command button, but it would be better if the function could just run if the data on the sheet is changed.
>
> Thanks!
Jamie Collins - 14 Jul 2004 09:49 GMT
> This must be elementary, but I am new to VBA. I have a SQL query that returns data to my sheet that is grouped by status, and ordered by date. Here is an example of what is returned:
> 9/27/2003 17:00    1    Open-Propose
[quoted text clipped - 10 lines]
> 9/27/2003 17:00    33
> 10/4/2003 17:00    44

I think this is the query you require:

 SELECT
   MyDateTime,
   LEFT(MyStatus,4),
   SUM(MyAmount) AS MyAmount
 FROM
   MyTable
 GROUP BY
   MyDateTime,
   LEFT(MyStatus,4)
 HAVING
   LEFT(MyStatus,4)='Open'
 ORDER BY MyDateTime
 ;

Jamie.

--
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.