Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

690
Views
Excel VBA/C# Subtotal Function: What does TotalList parameter do?

I'm trying to get the subtotals for a table in C# using Microsoft.Interop.Excel, and there is a built in function for that.

[Here][1] is the link to the documentation for the Subtotal function.

I understand what GroupBy and Function parameters do, but what exactly is the TotalList parameter for? Microsoft describes it as:

"An array of 1-based field offsets, indicating the fields to which the subtotals are added."

How are these offsets being read? In pairs for row and column offset? In examples I see whole arrays of many numbers being used for this. How do I make use of this? [1]: https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.excel.range.subtotal?view=excel-pia

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You pass an array of as many numbers as you have columns for which you want subtotals calculated. If you only have one column to subtotal, you can just pass in a single number in place of an array (at least, in VBA that works)

Eg: (in VBA) -

Range("A1").CurrentRegion.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3, 5)

would group a table of data starting in A1, according to the first column, and add subtotals in the third and fifth columns.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!