Summing visible column values but not hidden column values

I need to write a SUM function that will add up the numbers in several 
columns of data (for example, A4:S4), but I only want it to add those columns 
that are visible, not those that are hidden.  Is there any way to have Excel 
add only the numbers in the visible columns, not in any hidden columns?  
Thanks.
0
bw (26)
11/2/2004 6:14:07 PM
excel.misc 78881 articles. 5 followers. Follow

2 Replies
758 Views

Similar Articles

[PageSpeed] 13

Hi
have you hiddent he columns manually?. If yes you'll need VBA

--
Regards
Frank Kabel
Frankfurt, Germany

"BW" <BW@discussions.microsoft.com> schrieb im Newsbeitrag
news:CBAFDFDF-FFFD-4521-97EC-CD3941FD8686@microsoft.com...
> I need to write a SUM function that will add up the numbers in
several
> columns of data (for example, A4:S4), but I only want it to add those
columns
> that are visible, not those that are hidden.  Is there any way to
have Excel
> add only the numbers in the visible columns, not in any hidden
columns?
> Thanks.

0
frank.kabel (11126)
11/2/2004 6:23:05 PM
If you put this code into the editor you can then use the function 
sum_visible_cells
instead of =sum(a4:s4) you type =sum_visible_cells(a4:s4)

Function Sum_Visible_Cells(Cells_To_Sum As Object)
    Application.Volatile
    For Each cell In Cells_To_Sum
        If cell.Rows.Hidden = False Then
            If cell.Columns.Hidden = False Then
                total = total + cell.Value
            End If
        End If
    Next
    Sum_Visible_Cells = total
End Function


"BW" wrote:

> I need to write a SUM function that will add up the numbers in several 
> columns of data (for example, A4:S4), but I only want it to add those columns 
> that are visible, not those that are hidden.  Is there any way to have Excel 
> add only the numbers in the visible columns, not in any hidden columns?  
> Thanks.
0
Nikki (101)
11/2/2004 6:32:04 PM
Reply:

Similar Artilces:

Excel2007 Replace formulas with {=#Value!} when saving file
The file is in Excel 2003 (created in Excell 2003) format. "FileName [Compatibility Mode] ..." displayed on title bar when loaded in Excell 2007. There are several worksheets in the workbook with array formulas referring to other worksheet. When saving the file a message pops up saying "saving this file in 2003 format will lose information, formulas will be converted to {=#Value!} as the 2003 format cannot handle the quatity of formulas in this workbook". If you select "Continue" that is exactly what happens: poof, most of your array formulas are replaced. ...

How to perform sum sum sum...
How to perform sumation within that particular item but the item is not unique...means item 1 has its own quantity and same goes to item 2...but in the same table... -- Message posted via http://www.accessmonster.com On Tue, 17 Apr 2007 05:28:12 GMT, "EMILYTAN via AccessMonster.com" <u33296@uwe> wrote: >How to perform sumation within that particular item but the item is not >unique...means item 1 has its own quantity and same goes to item 2...but in >the same table... Group By the item. For a more detailed answer, please post a more detailed question (with a des...

How to get #value! to return a value of 0?
My formula is like this: =A2+B2+C2. However, some of the values in the B2 column are "--," indicating "not applicable". When I use the formula, it interprets this as text, of course, and returns the error value of #VALUE! I want it to treat these as zeroes. How can I do this? I tried doing a FIND AND REPLACE, but it did not recognize any of the "-- " values in the FIND. Can anybody help? =SUM(A2:C2) would be the easiest way. SUM will ignore text. tj "rhodesv" wrote: > My formula is like this: =A2+B2+C2. However, some of the values i...

Summing up user defined results
Hi all - I'm new to VBA programming in Excel and so any help i'd totally love! I'm currently writing a function. Objective: user can select rows (do not have to be sequential). User clicks on button. UserForm appears with summed results from ONLY rows that he selected. What I have now, well it doesn't work: Sub Button6_Click() Dim i As Integer Dim totalNumbers As Integer Dim aRange As range For Each a In Selection.Areas 'MsgBox "Area " & i & " of the selection contains " & _ ' a.Rows.Count & " rows." &...

Null value won't pass into function
Hi All, I have started tearing my hair out over this problem! I am pulling some data from a table and passing it as variables into a function in Access. One of the variables I'm passing through can be Null, so to avoid trying to pass a Null value to a function as a string (which I gather Access wouldn't like) I created an IIF function inside the parameters so if the value was null, it passed the string "NULLDEPOT" into the function, and I dealt with it inside the function. No matter HOW I try (stacked queries, new variables, taking the IIF out of the function parameters an...

Multiple variables to sort and sum, return values<0 with sum refer
Can anyone help me with this one please? I have this table of data. I'd like to be able to write a formula(s) which sums the No according to date and code, but then only returns a sum value (with the code and date in the two adjacent cells) if there is a value greater than 0. Code Ref No Date 1 G/032/05/999 400600 212 19/03/2010 2 G/032/03/001/999 400500 50 19/03/2010 3 G/032/02/001/001 400400 170 19/03/2010 4 G/032/05/999 400600 315 19/03/2010 5 G/032/03/001/999 400500 300 19/03/2010 6 G/032/05/999 400600 202 19/03/2010 7 G/032/03/001/002 40...

sum subform to form
=Sum([Forms]![frmCamPledgeList].[frmCamPledgeListSub].[Amount Pledged]) Form (frmCamPledgeList) with subform frmCamPledgeListSub). Subform has a field named Pledge Amount. I want to put a field on the form that gives me a total of the subform's Amount Pledged. I have tried the above, but I get an #error in the unbound text box. Do you need any more info? Any thoughts on why this does not work? Thanks in advance, Scott -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200912/1 The proper syntax is =Sum([Forms]![frmCa...

How to Combine Data from Several Columns?
Hi Everyone I have attached a file which contains what I need to resolve Basically, I need to combine the data in several columns together int one column. Is there a way I can do it with formulas or vb code? would really appreciate if any experts out there can help me. Thanks and Regards Kelvi Attachment filename: book1.xls Download attachment: http://www.excelforum.com/attachment.php?postid=46105 -- Message posted from http://www.ExcelForum.com Hi Kelvin! Probably the answer will be something like: =A1&" "&B1&" "&C1 ...

Calculate sum of a field within the query
I have a query that returns the details for a failure record during a specified time period. Where if I search between 1/1/08 and 1/31/08 the query returns the records of all failure records during that period. The row shows the part number and the total parts failed for that record. I need the query to then sum the total part failures for the previous 12 months. So I would see the following: Record # | part # | parts failed | Origination Date| Total Parts failed past 12 months 44444 | x | 4 | 1/2/08 | 200 44445 | Y |1 ...

Deleting multiple rows from value list
Is there a way to delete multiple rows in a value list for a Text column? I have over 200 rows out of a value list that are duplicates that I need to delete. I can delete them row by row but I'd like to click on the 1st row and shift click on the last row that needs to deleted. Is this possible? Thanks in advance (from a Project newbie) Yes. Select then click on the cut icon. Try it. -Jack Dahlgren "Val" <Val@discussions.microsoft.com> wrote in message news:6596A51E-9C60-46A4-B9AB-AAB335A92906@microsoft.com... > Is there a way to delete multiple ro...

Calculating a percentage from values in two different fields
Hi, I have a query called SalesBudget3 that has fields which include: CustomerName, Type and then all of the months of the year (January, February). The type field is either Actual or Budget. My query will return two records per client. The first would have their actual sales for 2008 and the second would have their budgeted sales. In my report, I have the field names in the page header (Type, January etc) and CustomerName in the CustomerName header. The Details sections has their monthly sales figures. In the CustomerName footer, I want to calculate percent of Actual to Budget pe...

how to make this work if sum=5+n2 then sum becomes the value of s.
I want to get or create a formula in excel or access that allows me to keep a running total of my supplies ie... I have 2 pens, remove one and receive 2. answer in the cell becomes 3 pens then if I zero out the received cell the inventory cell still remembers that I have 3 pens not 4 pens (because I received 2 more pens) and visa versa when I zero out the received cell it remembers I have 3 pens not 1 pen(because I removed 1 pen) I believe the method you suggest is flawed. You have no audit trail. If the number on the sheet doesn't match your actual inventory, how will you figure out...

=SUM Ranges Do Not Update
I have a Excel 2000 spread sheet, with the following macro to insert new row. Sub InsertRow() ' ' Macro1 Macro ' Macro recorded 4/27/2004 ' 'GoTo label, MyString ActiveSheet.Unprotect Application.Goto Reference:="MyCell" ActiveCell.Select ActiveCell.EntireRow.Insert ActiveCell.Offset(-1, 0).Select ActiveCell.EntireRow.Copy ActiveCell.Offset(1, 0).Select ActiveCell.PasteSpecial xlPasteAll Application.CutCopyMode = False ActiveCell.Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True Scenarios:=True End Sub The problem is that in the "Mycell&qu...

Hyperlink to first blank cell in column?
(XL2007) Thanks to help from MVP Biff, I can return the row number of the first blank cell in a single-column named range using an array formula (http://tinyurl.com/qb689k). This is a dynamic range that will adjust as new items are added. I'm setting up a workbook in which I have a "Blank Master" sheet and a "Jobs List" sheet. The "Master" sheet will be copied and renamed for each month. I'd like to have a hyperlink on the "Master" sheet that will carry over to each new copied sheet that would take the user to the first blank cell in the JOB...

Sum value between dates problem driving me mad!
Good Evening All, I am really struggling here, have tried, nested IF's including AND's but am a bit stumped. I am fairly familiar with Arrays, but cannot seem to combine all. I have a data table (as detailed below). (Hopefully, this should be 'pastable' into Excel - it works for me) I simply wish to calculate the expected totals per month. Any help & assistance with this would be most welcome. Cheers, Mathew Note, earliest Start is 01/04/03 Start Finish Day Rate Apr-2003 May-2003 Jun-2003 Jul-2003 Aug-2003 01/04/2003 23.00 01/04/2003 09/07/2003 23.00 ...

Conditional Sum Wizard
Currently I am setting up a sheet and I am using the conditional sum wizard for formulas. Once a formula is created the sytem won't let me copy or change a formula. If I try to copy (Copy, paste special) a formula to another cell, the formula won't work anymore. If I create a formula with the wizard and afterwards change one of the parameters, the formula does not work anymore. Can anyone give me a hint on how I can solve these issues? Thanks. Please don't multi-post - you have an answer elsewhere, relating to use of CSE. Pete On Jan 6, 9:23=A0am, MarcoKoenders <MarcoKo...

XIRR & non-Contiguous Values?
I know IRR works with non-continguous values, but I can't get XIRR to work. Here's what I'm doing: =XIRR((B1,B5), (A1,A5), 0.07) A B 1/21/2005 -750 - - - 12/31/2005 795 I get #VALUE! IRR works on the same cells, minus the date arguments of course. Bob bluepost22@yahoo.com wrote: > =XIRR((B1,B5), (A1,A5), 0.07) should those have colons between the cells? like B1:B5 In this case I only have two dates and two values which are not located in adjacent cells in the spreadsheet. This is supposed to work in IRR, and it does, but I can't get it...

stop all the columns coming up the same length in a chart
when i try to make a chart in excel all the columns come up the same length and it won't display the years either Hi, Your post is a bit lite on detail so I have more questions than answers. Is it possible you have selected the 100% stacked column chart? What data do you have and how is it laid out? Where should it be displaying the years, axis or as data labels? Cheers Andy prinshin wrote: > when i try to make a chart in excel all the columns come up the same length > and it won't display the years either -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info ...

Sum Question
I am using Excel 2000 I have the following very simple formula in column j Sheet1 =SUM(B5*H5) I have this copied all the way down to line 40. It shows 0 in all of the cells all the way down. I would like for there to be a way that the cell would not show anything in it UNLESS there was something that it was calculating. For example. I have entered data in column b and column h through line 10, but it still shows 0 in column J all the way down to line 40. I realize that it is showing these 0's b/c I have placed the formula there, but is there a way that it will still calculate but only ...

Line
I have a table with 4 columns and I want to show three columns as bars on one axis and one as a line on the other axis but the standard format always splits the table into two bars and two lines. Even if I transfer the third column into the primary axis it still stays as a line. Any help will be great. Ta, Michael Hi Michael, Best thing to do is create a Column chart based on all 4 data series. Them select the data series that you want to plot as a line. Right click and pick Chart Type from the popup menu. Pick the appropriate line chart. Michael C wrote: > I have a table with 4 col...

update column in VLOOKUP when columns are inserted
Folks, Is there a way to automatically change the column (where the data is to come from) in the VLOOKUP function so that when a column is inserted into the worksheet, the column in the VLOOKUP advances by 1? Of course, the reverse would apply when a column is deleted. Mike I think this is what you may want. =VLOOKUP("a",A1:E5,COLUMN(C3)) -- Don Guillett SalesAid Software dguillett1@austin.rr.com "Takeadoe" <mtonkovich@msn.com> wrote in message news:1144674331.433127.117960@j33g2000cwa.googlegroups.com... > Folks, > > Is there a way to automatically ...

Sum sum sum
Let me describe my problem... I have a form with with item number with is unique and then i put another form (subform) to linked to record the number of item in and out.... This means a item can have many in and out transactions which make the item number not unique.. My problem is I want to calculate the sum of in quantity within the same item. I want the sum to be keep on increasing when the user enter the quantity. Example user key in 2 then new user key 4 and i want the total quantity to be 6... Please help.... No idea of what i am talking? I will explain... -- Message posted via http:/...

Multiplie a column by 2
Hey, Got a column I wanne multiplie by 2. It goes from I6 to I2237 so it takes some time if I gotta do it manual. Each cell gotta be multiplie by 2. Hope this made any sense. Thanks -- Message posted from http://www.ExcelForum.com Hi - put the '2' in an empty cell and ocpy this cell - select I6:I2237 - goto 'Edit - Paste Special' and choose 'Multiply' -- Regards Frank Kabel Frankfurt, Germany > Hey, > > Got a column I wanne multiplie by 2. > It goes from I6 to I2237 so it takes some time if > I gotta do it manual. Each cell gotta be multiplie ...

indirect reference to a column or row
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel This has to be an old question, and probably everyone in the world knows the answer except for me.... <br><br>I want to make and indirect reference to a row or column in a formula. Such as: <br> &nbsp;A(function that gives some row number) <br><br>I simply cannot figure how to do this- can I do this? If so, how? <br><br>Thanks, <br> Snale <br> Dale Brown In article <59bb2368.-1@webcrossing.JaKIaxP2ac0>, Snale@officeformac.com wrote: > Versio...

change color to selected columns in a stacked column chart
Can I change colors to selected columns in a stacked column chart? I have 3 data series for each year, and would like each group of 3 to be colored differently. The 'vary colors by point' option [under format data series/options] is disabled for this type of chart. Thanks, Noa Click once to select a series of columns, then click again to select just one column, then format it like any other element (Format menu, double click, or Ctrl+1). - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _____...