SUBTOTAL Function Syntax
Jul 26, 2007I have a spreadsheet that deals with payments and has subtotals in it. Every subtotal formula begins like this: =SUBTOTALS(9,H212:H225). My question is: What does the "9" and the "comma" mean?
View 3 RepliesI have a spreadsheet that deals with payments and has subtotals in it. Every subtotal formula begins like this: =SUBTOTALS(9,H212:H225). My question is: What does the "9" and the "comma" mean?
View 3 RepliesAlways have problems getting my head round the syntax of the indirect function and am unable to find anything similar that's been asked.
I want to perform an operation on two numbers where the user selects which to use (add, subtract, multiply or divide) entered into another cell like this:
******** ******************** ************************************************************************>Microsoft Excel - 200701 - LCC.xls___Running: 11.0 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutC3C5=
ABCD14+5*2****3Normal*9*4****5Indirect*#REF!*Sheet3*
[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box
PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.
I'm trying to create a new function in Excel and for some reason the syntax is incorrect and it won't let me use it in the sheet. I do not know what I'm doing wrong so any help would be appreciated. This function will allow me to interpolate the term structure of interest rates between dates (I think) My code is
Function INTSPOT(spots, year)
'Interpolates spot rates to year
Dim i As Integer, spotnum As Integer
spotnum = spots.Rows.Count
If Application.WorksheetFunction.Count(spots) = 1 Then
'Single rate given
INTSPOT = spots
Else 'Term structure given
If year = spots(spotnum, 1) Then
INTSPOT = spots(spotnum, 2)
Else
Do
i = i + 1
Loop Until spots(i, 1) > year
INTSPOT = spots(i - 1, 2) + (spots(i, 2) - spots(i - 1, 2)) * _
(year - spots(i - 1, 1)) / _
(spots(i, 1) - spots(i - 1, 1))
End If
End If
End Function
Originally Posted by Syntax
IF(logical_test, [value_if_true], [value_if_false])
I noted today that in the helpfile topic for the IF() worksheet function it is possible to omit both the function's 2nd and 3rd arguments.
Although to do so you have to add a comma after the logical_test, eg:
=IF(A1="hello",)
When both [value_if_true] and [value_if_false] arguments are omitted the function always returns 0 if the condition is met or FALSE() if the condition is not met (unless the condition references an error value in which case an error is returned).
Note - I'm comfortable with leaving one of these arguments out, just can't think of a valid application for leaving both out. Just a feeling in the back of my mind that the fact that IF() in this format is able to return different data types (number vs logical depending on condition=TRUE vs FALSE) might mean that there could be a clever use for it?
I get syntax error on return statement. I am using Excel 2010.
View 2 Replies View RelatedI have got a multisheets database where both rows and columns may be
hidden according to a given criteria. Only blanks rows and columns
should be hidden.
Now I need a formula to check if there is no "valuable" data hidden.
Checking test might be:
SUBTOTAL(9,reference) = SUBTOTAL(109,reference)
I would to use the subtotal command and have it exclude rows from another column in addition to obeying an autofilter:
A B C
1 Area Rep Name Amount
2 Quota John 100
3 NW John 200
4 NW John 300
I want to use the subtotal(9) on the amount column, but I don't want it to include rows where the value Quota is in the area column. The idea is that the amount for a given autofilter condition (rep = john) should only show his forecast amounts but not his quota number for his area. DSUM includes hidden row as does sum
I have tried
subtotal(9,sum(C2:C4*(A2:A4<>"Quota")))
but that does not work
=SUM(C2:C4*(A2:A4<>"Quota"))
works but does not let me filter the data to only show values for john versus all reps
I'm trying to calculate the mode for a large data set, but there is no 'mode function' in subtotal. I need to find the mode for each change in day - without having to retype the function.
View 11 Replies View Related(I've actually gotten what I needed through some very convoluted formulas, but I thought there MUST be an easier way!!)
I have three columns of data:
foldername1TEST0001TEST0006
foldername1TEST0007TEST0008
foldername1TEST0009TEST0018
foldername1TEST0019TEST0021
foldername1TEST0022TEST0022
foldername1TEST0023TEST0028
another folderTEST0029TEST0031
another folderTEST0032TEST0039
another folderTEST0040TEST0056
yetanotherTEST0057TEST0058
yetanotherTEST0059TEST0101
yetanotherTEST0102TEST0104
yetanotherTEST0105TEST0106
yetanotherTEST0107TEST0154
yetanotherTEST0155TEST0190
foldername1TEST0191TEST0197
foldername1TEST0198TEST0267
foldername1TEST0268TEST0275
I am trying to get a "range" for each folder using the first instance in columnB and the last instance in columnC. For example, what I need to end up with is:
foldername1TEST0001TEST0028
another folderTEST0029TEST0056
yetanotherTEST0057TEST0190
foldername1TEST0191TEST0275
Again, I was able to finally accomplish this, but it took some way outside the box steps. Tried it in Access with simple query for Min and Max, but the caveat is that there are identical folder names for different ranges (see "foldername1) that need to be captured and I was getting results like "foldername1 TEST0001 TEST0275", which is incorrect.
I am trying to create a macro which will use the subtotal function to do a count on all the the new loans in column A. The could below is what I have tried but I am getting a run-time error 13 "Type Mismatch" error at the line highlighted in red in the code. How to write the Subtotal function in the macro.
Code:
Sub CountNewLoans()
Dim cnlFinalRow As Integer
Dim cnlRow As Integer
Dim x As String
Dim y As String
[Code] ......
I´m writting a macro. It works find until a certain point. When I want to change some outputs of the macro without changing the syntax, it display an error mesage while runing the macro. It says Else without If. Which is quite disturbing because the Else was not creating any problem before. Here is my macro before I changed the conditions (this one work nicely)
Sub Copy_Sheet_Beta()
Set wba = ActiveWorkbook
On Error Resume Next
If IsWorkbookOpened("Projekt.xls", "C:Documents and SettingsfrederikSkrivebordRedd Barna") Then
Workbooks("Projekt.xls").Activate 'In case open, just activate "Projekt"
Else
Workbooks.Open Filename:="C:Documents and SettingsfrederikSkrivebordRedd Barnaprojekt.xls"
End If
Set wb = Workbooks("Projekt.xls")
wb.Activate
If Not SheetExists(wba.ActiveSheet. Range("C1").Value) Then
MsgBox "overall doesn't exist!"
Else........................................
I'm looking for a formula that acts the same way as the subtotal formula (revises if rows are hidden and only adds visible rows). Is there anyway to get this removal of hidden rows but for subtraction?
View 3 Replies View RelatedIs it possible to use the worksheet function Vlookup on subtotal values? If so what is the formula? The problem that I am trying to solve is as follows. I have a sheet (1) listing part numbers that are not moving at a particular depot. On another sheet (2) there are details of sales relating to the non-moving part numbers at 6 other depots, I have added subtotals. Currently I am switching between worksheets to see if I can transfer stock. I would like to id on sheet 1 the total number of sales at other depots, then I can see what part numbers may be transferrable without a great deal of manual intervention.
View 2 Replies View RelatedI'm trying to exclude cells that are filtered in a separate sheet.
The sheet I'm working with gathers information from this separate sheet using the following SUMIF formula:
=SUMIFS(Claims!$H:$H,Claims!$G:$G,$A9,Claims!$B:$B,C$6,Claims!$E:$E,$B9)
This formula extrapolates information perfectly for me if I do not filter columns in the separate sheet with all of the information.
I know that SUBTOTAL functions can be used in a way to exclude hidden cells. Can I combine the SUBTOTAL function into my SUMIF function above to produce results that exclude filtered cells?
I'm working on a workbook that will track staffing patterns.
The workbook has three worksheets: Sheet1 "RCS", Sheet2 "HCT' and Sheet3 "Hidden". I've attached the workbook to this thread. The password for the form is "j".
On Sheet3 "Hidden" I have two tables that are set up to collect the SUM of columns on Sheets1 "RCS" and Sheet2 "HCT". I'm finding the SUM of each range by way of the background color. I've set up the following formulas and when the "data collection tables" are in the same worksheets as the original information, the formula's work perfectly:
The following functions are pulling data from Sheet1 "RCS" and placing them into a table in Sheet2 "Hidden"
[Code] ........
The following functions are pulling data from Sheet1 "RCS" and placing them into a table in Sheet2 "Hidden"
[Code] .......
I have two more functions that aren't working due to the fact that the source values are percentages and NOT plain numbers. The above functions work great for SUM but not for percentages. EXAMPLE--Let's say, 3 sub percentages it gives me the SUM of the 3 percentages (i.e. 85% + 100% + 100% = 285% instead of giving me 95%.
[Code] ........
How might I use the following functions to find the average of the source fields instead of the SUM?
way to do this but i have a sheet that is into 5 - 6 thous rows, in one of the columns (names) i sort it by names and then order it by subtotal for certain values.
What i need to know, is there anyway i can take just the subtotal values out and put onto another spreadsheet without copying and pasting it all as there are lots of subtotals and this would help alot as the other info is not nec. just the subtotal'd info. either that or is there anyway i can highlight the subtotal'd row info in yellow/bold text anything like that that would make it stand out without having to do it manually?
I’m trying to get my sheet so that at each change in month it creates a sum of the value but I want to sum to show up in the subtotal value column.....
View 10 Replies View RelatedIm having problem with If/Then/Else Statements Not sure what the problem is. I have a text box a user inputs whatever in to create two new tabs one is the tab name then the next is tab completed. It isnt liking my syntax I have here.
View 7 Replies View Relatedif I copy and Add it created a new workbook not the current on im in. What am I doing wrong?
View 5 Replies View RelatedGetting a syntax error which and I'm not sure what I've done wrong. This is the bit thats causing the problem:
View 2 Replies View Relatedtrying to write a formula in a VB to some cells:
View 3 Replies View Relatedwhat is wrong with this syntax:
View 2 Replies View RelatedI would like to have an email generated when a cell changes to a particular value. I've developed the macro to send the email with a saved attachment.
When I try to OJT-Engineer the text for the module, I can't get it to recognize the macro. It's a syntax issue, it seems.
What I need is for my module to initiate a macro when a cell changes to a value.
This is the code EXACTLY as it appears:
A theoretical question following an empiric result.
For the command “SendKeys”, for instance, take these two lines:
What is wrong with the syntax of this formula?:
COLUMNS(INDIRECT("AverageDemand!$A7:"&A$7))+4
I'm getting #REF errors and I can't work out why...
I have the following code that loops thru and puts the word 'TEST' in column J if column B has a TEXT value of '020'
----------------------------------------------------------------------------------
With Range("J1:J" & Lastrow)
.Clear
Range(.Cells(2), .Cells(.Count)).Formula = "=if((b2)=""020"",""TEST"","""")"
End With
----------------------------------------------------------------------------------
Questions
1) why do I need double quotes "" "" on every argument in the function? Is it because I'm working with TEXT data?
2)I want to use multiple ifs (ie if cell b2 equals '020' OR '030' then put the word 'TEST' in col J). How to change the syntax to do this?
I know this syntax isn't right.
I have a form and a combo box that I want ot fill the items in from cell F22.
Here is my
Sheets(PowerAnalysis.xls).Cells("F22").Value = ComboBox2.Text
What is the best way to get this done? I have searched here and on the web and I can't seem to find any straightforward answers.
I am trying to get the below autofilter working but to no avail, its just putting the text datStart and datEnd in the auto filter, not what I receive in the boxes, see bold line for line in question
Dim datStart, datEnd As Date
Dim strAgent As String
datStart = txtStart.Value
datEnd = txtEnd.Value
strAgent = txtAgent.Text
Range("A4").Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:=">datStart", Operator:=xlAnd, _
Criteria2:="<datEnd"
I thought I saw a thread where someone used AutoFilter as a one liner like
Range("VFILTER").AutoFilter 23, "True"
but for some reason this does not work. The filter is active, but it doesn't pay attention to the field or criteria part.
In VBA Excel 2000 while ODBC connecting to a dbase file:
parameter=" N0011"
...
ActiveSheet.QueryTables.CommandText = Array( _ ...
"SELECT ... & Chr(13) & "" & Chr(10) & _
"FROM ... & Chr(13) & "" & Chr(10) & _
"WHERE (dbase_file.field1=" & chr(34) + parameter + chr(34) & "... & Chr(13) & "" & Chr(10) & _
"ORDER BY ...")
...
It doesn't work any more in Excel 2003. Of course it works directly such as:
"WHERE (dbase_file.field1=' N0011')
but I couldn't find the way to replace the ' N0011' with the parameter.
It is not the singular issue...
"FROM dbase.file dbase.file " that worked well in Excel 2000, the Excel 2003 "wants":
"FROM 'drivepath'dbase_file dbase_file "
and I couldn' find a way to replace the explicit 'drivepath' with a predefined variable.