1

我有这样的数据

      A      B   C   D
1. Customer T/C NET VAT
2.  Sandy    T1
3.  Sandy    T5
4.  Sandy    T1
5.  Sandy    T5
6.  Candy    T1
7.  Candy    T5
8.  Dandy    T5
9.  Dandy    T1

where NETand VATcontains $Amount& 1,2etc 是行号 & T1/T5 是 TaxCodes

汇总列

      R        S      T
1. Customer  T5NET  T5VAT
2.  Sandy 
3.  Candy 
4.  Dandy 

我想分别在客户面前的摘要列中总结NET+ 。VATcell.address

示例:汇总列

       R        S      T
 1. Customer  T5NET  T5VAT
 2.  Sandy   =C3+C5  =D3+D5
 3.   etc

我假设我需要一个Match函数来匹配#1 Customer(汇总到数据库),#2 T5然后将偏移值与汇总名称连接起来。

立即编辑(这很接近,但我如何为匹配功能更改它?)

`Sub MatchConcanate()
Dim outputText As String, Rw As Range, cell As Range
delim = "+"
Application.ScreenUpdating = False
Range("A:A").SpecialCells(xlCellTypeConstants).Select
For Each Rw In Selection.Columns
'Here I want it to only Select Supplier till it is duplicate (they are sorted) and then to next
    For Each cell In Rw.Cells
    If cell.Value = "T5" Then
        outputText = outputText & delim & cell.Address
    End If
    Next cell
    With Rw
'Here I'd like a match function instead of pasting it all in cell 1
    .Cells(1).Offset(0, 5).Value = outputText
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    End With
    outputText = ""
Next Rw
Application.ScreenUpdating = True
End Sub`
4

1 回答 1

0

将所有内容向右推一列并放入 A1 "=B1 & C2" 。例如客户和 T/C

然后在你的列中你想要 sum 使用 sumif

Name T1 T2
Sandy =SUMIF(A:A,S2&$T$1,D:D) =SUMIF(A:A,S2&$U$1,D:D)
Candy =SUMIF(A:A,S3&$T$1,D:D) =SUMIF(A:A,S3&$U$1,D:D)
Dandy =SUMIF(A:A,S4&$T$1,D:D) =SUMIF(A:A,S4&$U$1,D:D)

由于新列“A”,范围已超过一

于 2015-07-08T14:28:10.223 回答