English 中文(简体)
Excel“合计”阵列公式——其他方式的总和。
原标题:Excel "Subtotal" array formula - Other form of sum.if

这是继续的问题excel不同的SUM。 综合框架阵列功能 但是,由于我已经指出这个问题已经解决,我产生了一个新的问题。

我所希望的是,一些价值观是独特的,我已经执行了“马克”的解决办法。 然而,报告的要求发生了变化。 现在,我需要排除所有隐藏的、但仍然保持原计算方法的价值。 从根本上说,希望以同样的方式增加一个SBTAL(109,f)会发挥作用的特点。

对我来说,“VBA”功能小组(Range)是一种简单的功能,视小组而定,其回报为0或1。

因此,我最好的猜测是如下公式:{=SUM(IF($B1:$B7<>$B2:$B8,D2:D8,0CellIss NotHidden(D2:D8)}

但是,这一职能并不奏效,因为受感染的细胞并不是一种阵列功能。

我如何解决这一问题?

预先感谢

Gunnar

Edit:

我认为,我应当包括一个简单的传统做法职能:

  Function CellIsNotHidden(InputRange As Range)

  If InputRange.Cells.Height = 0 Then
      CellIsNotHidden = 0
  Else
      If InputRange.Cells.Width = 0 Then
          CellIsNotHidden = 0
      Else
          CellIsNotHidden = 1
      End If
  End If

  End Function
最佳回答

Try this for UDF CellIsNotHidden/aco>. 这将处理1个(校长)和2个阵列。 测试:

Function CellIsNotHidden(MyRange As Range) As Variant
  Dim RootCell As Range
  Dim tmpResult() As Long
  Dim i As Long
  Dim j As Long

On Error GoTo Whoops
  ReDim tmpResult(0 To MyRange.Rows.Count - 1, 0 To MyRange.Columns.Count - 1)
  Set RootCell = MyRange.Cells(1, 1)
  For j = 0 To MyRange.Columns.Count - 1
    For i = 0 To MyRange.Rows.Count - 1
      tmpResult(i, j) = Not (RootCell.Offset(i, j).EntireColumn.hidden Or RootCell.Offset(i, j).EntireRow.hidden)
    Next i
  Next j
  CellIsNotHidden = tmpResult
On Error GoTo 0
  Exit Function
Whoops:
  Debug.Print Err & " " & Error
End Function
问题回答

不要使用UDFCellIss NotHidden(D2:D8),你还可以尝试其中任何一个:

SUBTOTAL(109,OFFSET(D2,ROW(D2:D8)-ROW(D2),))
SUBTOTAL(109,OFFSET(D2:D8,ROW(D2:D8)-MIN(ROW(D2:D8)),,1))




相关问题
import of excel in SQL imports NULL lines

I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Excel date to Unix timestamp

Does anyone know how to convert an Excel date to a correct Unix timestamp?

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Importing from excel "applications" using SSIS

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...

热门标签