Excel: Is there a way to change the “Group Total” label in a subtotal row?

StackOverflow https://stackoverflow.com/questions/9012133

  •  19-04-2021
  •  | 
  •  

Вопрос

I am looking for a way to change the label of a subtotal label to just say total instead of group total.

So instead of this:

Group    Value
A        100
A        200
A Total  300

I get this:

Group    Value
A        100
A        200
Total    300
Это было полезно?

Решение

You can write a quick macro to change it. Assume that the subtotal formulas are in column B (b2:b8 in my example, easy to change), and the "group total" titles are in column A, then this should work:

Dim mycell As Range

For Each mycell In Range("B2:B8"):
    If Mid(mycell.Formula, 1, 9) = "=SUBTOTAL" Then
        mycell.Offset(0, -1).Value = "Total"
    End If
Next mycell
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top