Auto Sum unknown number of rows

Im using odbc to import data from a database.

Imported is a list of products in column A and then various columns
containing sales figures.

Because of the import from the database, I do not know how many rows of
products will appear,  this week we sell 500 different products, next
week 550.

I need to add totals to the columns directly under the last product.

I've tried creating the totals in an empty template and then inserting
the imported data so the total figures move down and appear at the
bottom. However the imported data
moves the total cells to the right instead of down.  Tried all methods
of inserting the data range, but the totals always move sideways.

Does anyone know how to automatically create total cells at the bottom
of a column of values so they appear under the last item ?
Remember,I do not know how many rows will be imported.

Alternatively, does anyone know why my totals move sideways when I
insert data into my template.
I tried selecting rows and columns and everything else I could think of
before inserting the data range.

is VB my only option ?

Thanks
Regards
Andy



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

0
10/7/2003 1:32:36 PM
excel.misc 78881 articles. 5 followers. Follow

2 Replies
717 Views

Similar Articles

[PageSpeed] 8

You can add the formula with a macro. Assuming the data starts in B2, 

  Cells(65536,2).End(xlUp).Offset(-1,0).FormulaR1C1 = "=SUM(R2C:R[-1]C)"

As for why the data moves to the right when you insert, you have a choice of which direction to
move, down or to the right. Are you sure you are selecting the right option?


On Tue, 7 Oct 2003 09:32:36 -0400, andy_lakeland <andy_lakeland.uxlgb@excelforum-nospam.com>
wrote:

>Im using odbc to import data from a database.
>
>Imported is a list of products in column A and then various columns
>containing sales figures.
>
>Because of the import from the database, I do not know how many rows of
>products will appear,  this week we sell 500 different products, next
>week 550.
>
>I need to add totals to the columns directly under the last product.
>
>I've tried creating the totals in an empty template and then inserting
>the imported data so the total figures move down and appear at the
>bottom. However the imported data
>moves the total cells to the right instead of down.  Tried all methods
>of inserting the data range, but the totals always move sideways.
>
>Does anyone know how to automatically create total cells at the bottom
>of a column of values so they appear under the last item ?
>Remember,I do not know how many rows will be imported.
>
>Alternatively, does anyone know why my totals move sideways when I
>insert data into my template.
>I tried selecting rows and columns and everything else I could think of
>before inserting the data range.
>
>is VB my only option ?
>
>Thanks
>Regards
>Andy
>
>
>
>------------------------------------------------
>~~ Message posted from http://www.ExcelTip.com/
>~~ View and post usenet messages directly from http://www.ExcelForum.com/

0
myrnailarson (145)
10/7/2003 2:15:34 PM
Hi Andy.  See if this does what you want.  In the B-column, assuming the
data you are pasting in begins in cell B2, enter the following formulas:

In cell B3: =IF(B2="","",B2)
In cell B4: =IF(B3="","",IF(SUM($B$2:B2)=B3,"",SUM($B$2:B3)))
Then copy the formula in B4 as far down as you need it.

Hope this helps.

Ken

andy_lakeland <andy_lakeland.uxlgb@excelforum-nospam.com> wrote in message
news:andy_lakeland.uxlgb@excelforum-nospam.com...
> Im using odbc to import data from a database.
>
> Imported is a list of products in column A and then various columns
> containing sales figures.
>
> Because of the import from the database, I do not know how many rows of
> products will appear,  this week we sell 500 different products, next
> week 550.
>
> I need to add totals to the columns directly under the last product.
>
> I've tried creating the totals in an empty template and then inserting
> the imported data so the total figures move down and appear at the
> bottom. However the imported data
> moves the total cells to the right instead of down.  Tried all methods
> of inserting the data range, but the totals always move sideways.
>
> Does anyone know how to automatically create total cells at the bottom
> of a column of values so they appear under the last item ?
> Remember,I do not know how many rows will be imported.
>
> Alternatively, does anyone know why my totals move sideways when I
> insert data into my template.
> I tried selecting rows and columns and everything else I could think of
> before inserting the data range.
>
> is VB my only option ?
>
> Thanks
> Regards
> Andy
>
>
>
> ------------------------------------------------
> ~~ Message posted from http://www.ExcelTip.com/
> ~~ View and post usenet messages directly from http://www.ExcelForum.com/
>


0
kensch (23)
10/8/2003 12:10:48 AM
Reply:

Similar Artilces:

Sum based on multiple conditions
I have Column A with a "stage" in it that will range from 1 - 8 I have column B with a "close date" in it that could be any date I have column C with a value in it. I need the sum of the values in C that have Close dates in any given range (ex. 10/1/2004 through 10/31/2004), that are in any given sales stage. I tried using SUMIF which seems to only work with 1 condition...so I can do =SUMIF(AA,1,CC) and it will give me the sum of the values that are in stage 1. SUMIF doesn't appear to work with ranges or multiple conditions though. =SUMPRODUCT((C1:C100>="...

Auto Filter problem
I am using the auto filter for a particular column to sort out differen medical programs. When I click the drop down and click a program, i doesnt show me ALL the lines that say this particular program. Why is this? -- Message posted from http://www.ExcelForum.com Hi maybe some hidden characters in these lines 8e.g. additional space characters, etc.) -- Regards Frank Kabel Frankfurt, Germany "jkb724 >" <<jkb724.19rasx@excelforum-nospam.com> schrieb im Newsbeitrag news:jkb724.19rasx@excelforum-nospam.com... > I am using the auto filter for a particular column to so...

Auto-Editing
Word 2003 has a very annoying default. It assumes too much! If I reformat a few words in a document, it changes the entire document to that formatting. Grr-rrr-r! I have to constantly press undo to get what I want. I know there's a feature that's causing this annoyance but I can't find it to turn it off! Can anyone help, please? See http://word.mvps.org/faqs/formatting/wholedocumentreformatted.htm. -- Stefan Blom Microsoft Word MVP "Connie Martin" <ConnieMartin@discussions.microsoft.com> wrote in message news:CD959D82-F81B-4A9D-993E-73...

Create a button to insert a new row.
I know Excel can do it; I just don't know how. In addition, once the new row is inserted, I need the formulas to carry into it. Any help is greatly appreciated! I can think of many possibilities, but I'm sure you are thinking of something very specific. Please give more information. -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Sharon" wrote: > I know Excel can do it; I just don't know how. In addition, once the new row > is inserted, I need the formulas to carry into it. > &g...

Auto-Calculate
I have a spreadsheet that utilize the stock quote add-in from MSN. On a daily basis I refresh the add-in functions for the Highs, Lows, Last, Volume, etc. On occasion the spreadsheet reverts to manual caculation settings, and I have to press the F9 even after I updated the quotes. I've always preferred the any spreadsheets I open, blank or otherwise, the automatic setting selected for calculations. I consider this an annoyance. Has anyone experienced this glitch? Is there a fix for it? Ron_D Ron Excel takes the calculation mode from the first workbook that opens in a session. Sub...

auto copy self
How do I arrange for Outlook to automatically copy myself on every new, reply or forward email? If you mean keep a copy of all sent, see settings under Tools/Options/Email Options and Advanced Options David "rich" <steamuk@aol.com> wrote in message news:055c01c3664f$dadecd30$a001280a@phx.gbl... > How do I arrange for Outlook to automatically copy myself > on every new, reply or forward email? ...

Auto correct or Auto complete
We are all familiar witht he auto correct or auto complete functions found in MS applications. Of course that means it is available in Access also. My question is this ... can this function be replicated within the DB, so that the set of auto correct items are part of the package rather than something that would have to be set up on each individual desktop system? It's use, for me, would primarily be within a memo field where medical abreviations, used as a shortcut, would convert to the true meaning as the user types them in. Ex: "prn" without quotes would change to. &qu...

Auto Scale Chart Macro -- Any improvements please?
This is the best way I've found to correctly scale a chart -- the only way I found to exclude a chart interpolating with #NA cells was to delete those cells containing #NA, and run the chart. This takes a long time on my computer. Wondering if there is a better way. This macro is directly taken from 2 excel mvps and modified; i believe a mehta and ron bovarty, but could be wrong. Thanks for taking a look. Sub AutoScaleYAxes() Dim ValuesArray(), SeriesValues As Variant Dim Ctr As Integer, TotCtr As Integer Application.Run "Extend_Stock_Data" Applic...

display number as number name
I want to get the number name of the corresponding number i enter. Hi see: http://www.xldynamic.com/source/xld.xlFAQ0004.html "Kamala Kannan" wrote: > I want to get the number name of the corresponding number i enter. ...

Problems with Inserting Rows
Morning Everyone In my previous version of Excel I could click on a row and then "Insert copied cells" anywhere on the sheet (as a new row). My problem is that with this version (2003 professional), when I try and re-insert the row, all the formulas have been converted to values. How do I switch back to inserting the row with formulas Many thanks in advanc Ja Inserting a row seems to work the same in Excel 2003 as in earlier versions, but maybe if you lay out the _precise_ steps to duplicate the problem someone can help you. In particular "re-insert the row" is unc...

OWA auto login
I am trying to use the credentials from the forms authentication login to automaticaly log in to Outlook Web. I redirect to a URL with this format: http://UserName:Password@mailserver/exchange I have seen this example in other posts but this does not work for me. I still get the Outlook Windows Login prompt. Perry Perecli Manole wrote: > I am trying to use the credentials from the forms authentication > login to automaticaly log in to Outlook Web. I redirect to a URL with > this format: http://UserName:Password@mailserver/exchange > I have seen this example in other posts but t...

macro help = extract content of specific columns accross a row
have a spreadsheet which consists of about 5125 rows and 2840 columns. I am using Excel 2007 in order to get access to the extra columns. Now I need help creating a macro to automate a very tedius and manual task. The first column in the spreadsheet is empty. What I Need =========== For every row I would like to extract the contents of certain columns accross the row and copy to the first column of the row. into the first column i would like to copy the contents of the following columns accross the row. 6C = sixth column, 9C = 9th column etc... 6C + " " + 7C + " &...

Any way to get rid of an auto-suggestion in the login dialog box, for Exchange/OL using RPC over HTTP?
A client was using RPC over HTTP to two different Exchange servers (OL prompting for profile on startup). Both profiles were set up to prompt for credentials upon connection to Exchange. There's now only one Outlook profile needed; the other is gone and OL isn't prompting for the profile selection any longer, which is fine. However, Outlook is remembering domain1\user and domain2\user in the login dialog box, and I'd love to be able to get rid of the no-longer-valid credential dropdown suggestion. (The computer is not a member of a domain and hence always needs to be prom...

Test number of decimal places in Currency format
How can I interrogate the system (Windows, I guess) to find out how many decimal places are specified in its Currency format? Alternatively, how can I test a number that's been entered to ensure that the user did not enter more decimal places than the Windows currency format permits (Access will store what's entered, but I want to reject what's been entered if it's not according to the Regional settings). Bob Randy Birch has code to give you details about the defined Locale Currency information at http://vbnet.mvps.org/code/locale/localecurrency.htm Note, though, th...

Auto look through subfolders
Please help. I can write a macro that will extract data from all excel files in a specific folder. What I need to be able to do is write a macro that will automatically extract data from excel files within folders and sub folders and sub sub folders etc For example the data is all held on the following directory: H:\development forms\2006 cost sheets\ And within that directory by customer - for example Tesco, Boots, Asda etc. These customers are then subdivided into product ranges - eg 1,2,3,4 etc and some futher subdivided by national or exclusive. All the excel files are in exactly th...

Count number of lines of text in a range/value.
To start, 1) Add a form w/ a textbox to your VBA project. 2) Set the textbox's AUTOSIZE property to False. 3) Set the textbox's MULTILINE property to False. In your code... 4) Call on the Form's SHOW method (modal or modeless is irrelevant). 5) Set the textbox's TEXT property to the (trimmed) value you are working with. 6) Set the textbox's AUTOSIZE property to True. 7) Set the textbox's MULTILINE property to True. 8) Save/get the textbox's LINECOUNT property. 9) Call on the form's HIDE method. btw, I assume no responsibility for the code. Use it at your own...

Auto date
I am trying to create a field in a form that if anything is changed on it, it will automatically update the date to current date. Is this possible? Sojaminc wrote: >I am trying to create a field in a form that if anything is changed on it, it >will automatically update the date to current date. Is this possible? Make sure the last changed date/time field is in the form's record source table/query. Then use the form's BeforeUpdate event: Me.lastchanged = Now -- Marsh MVP [MS Access] Hi - You can do this in the On Dirty event of the form, which fires as soon as you m...

An auto reply to an auto reply!
Had the funniest situation yesterday. Somebody emailed a public folder we have set up. On there we have a rule to send a reply saying thanks for your email -someone will be with you shortly (we have to have this message on - it is for some website that recently went live). Now that auto reply went back to the guy who emailed - who must have sent it from a public folder himself (as he forwarded the original email from a public folder). The guy received our auto reply - and promptly his email system sent an auto reply to us. As is the way it is set up - our email system sent him an auto ...

Auto-Alphabetize
I have a master data sheet, with columns of different information. I'd like to pull information from 3 different columns (Rank,LastName,Shift) into a separate column (I know how to do this). What I would then like to have happen is, in another separate column, have the information sorted alphabetically by last name. There are duplicate last names, in which case I'd like them sorted in rank order. Is this at all possible? Also, I can't use a VB Macro - it needs to be in a formula or array format. Rank.......LastName.........Shift PO Smith B/1 ...

substracting numbers in non contigous cells
Hi!=20 I need a formula to substract numbers in non contigous=20 cells THAT ARE IN ONE COLUMN and have the result in other=20 cell, for example: ........................A...................B R1..................................BLANKCELL R2..................................BLANKCELL R3..................................15 R4..................................BLANKCELL R5..................................BLANKCELL R6..................60.............75 R8..................................BLANKCELL R9..................................BLANKCELL R10................................BLANKCELL R11........

How do I auto-reply incoming eMails ?
During my holidays I want to inform the sender of incoming eMails that I am currently not in office. How can I setup an auto-reply note? Do I setup this in my Outlook 2003 or in the Exchange Server? Joe If you connect to an Exchange server at work, use the Out of Office function (under tools). It will reply once to each sender that you are out of the office. By default in Exchange, auto-replies to the internet are turned off so only internal addresses would receive the Out of Office reply but verify with your Exchange Admin how they have the server configured. If you have a POP3 acc...

Value List needs updating with 600 rows
Hi , I am attempting to get a list of 600 values added into a Value List without having to type them in...I have added them into the MSP_ATTRIBUTE_STRINGS table in a MS ACCESS copy of the project file however when I open the plan back up again in Project, the look up value list has not been refreshed..any ideas?? In Project 2007 you can cut and paste into the lookup table list from excel. That should be easier and safer than mucking around in Access. Isn't 600 values a lot to choose from? The users will have to scroll a lot. -Jack "Steve" <Steve@discussions....

Auto change of Row number within Formulas
Good morning , I would much appreciate some help in creating a formula which would do the following Cell Resul A1 B1 1 A simple formula would be - sum(c(a1):c(b1)), where the result in this case would be the sum of cells c5:c10. Many thanks, Gle Hi Glen, Look at the INDIRECT() function in HELP -- Kind Regards, Niek Otten Microsoft MVP - Excel "millarg" <anonymous@discussions.microsoft.com> wrote in message news:02302493-2C51-4CB9-9463-06523884BBD6@microsoft.com... > Good morning , I would much appreciate some help in creating a formula which would do ...

Double Numbers
I have a question. I have a series of 5 digit numbers in a spreadsheet. About 4000 o them, and I need to find out if there are any doubles. I sort by th column they are entered in and it puts the doubles together, but still have to scroll through every number and visually find them. I there any way I can do this without looking at each one? Please say yes! ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com Advanced Filter will do this, there's some great instruction...

Macro for Deleting rows with balnk cell
Hi, i have several data in a sheet with data in 10 columns... in column A there are cells where it is blank and i want to delete the rows where there is blank cell in column A.. I need the vba macro for this regards, radha Try Sub DeleteBlankRows_2() 'This macro delete all rows with a blank cell in column A 'If there are no blanks or there are too many areas you see a MsgBox Dim CCount As Long On Error Resume Next With Columns("A") ' You can also use a range like this Range("A1:A8000") CCount = .SpecialCells(xlCell...