Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6754537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:17:33+00:00 2026-05-26T13:17:33+00:00

Alright, Ill try to explain this as best as I can first… My program

  • 0

Alright, Ill try to explain this as best as I can first…

My program creates a dynamic table of information, Im trying to simplify some of the information by using a loop. To make it easy I will just say that the table starts on A1 and goes to (columnindex:rowindex*6) (that part is already done).

what I want it to do is to take the average of each column and put them somewhere else on the same excel sheet.

So Average(A1:A(rowindex*6)), Average(B1:B(rowindex*6)), and so on all the way up till Average((columnindex)1:columnindex(rowindex*6)

Now the tricky part….

Starting in A((rowindex*6)+5)…. So 5 rows below the table above starting in Column A….

Have it go…

Average(A), Average(B)
Average(C), Average(D)
Average(E), Average(F)

And so on until all the columns are listed…

Where I am struggling is converting columnindex to the appropriate letters as there is always 34-40 columns

I know that I would want to do something like:

i = 5

for x = 1 to x = columnindex 

    dim Num2Let1 as string = a=1, b=2, c=3, so on..
    dim Num2Let2 as string = a=1, b=2, c=3, so on..

    xlWorkSheet2.Cells((rowindex*6)+i), 1)  = "Average(" & Num2Let1.ToString & cstr(1) & ":" & Num2Let1.ToString & cstr(rowindex*6))
    xlWorkSheet2.Cells((rowindex*6)+i), 2)  = "Average(" & Num2Let2.ToString & cstr(1) & ":" & Num2Let2.ToString & cstr(rowindex*6))

    i = i + 1
    x = x + 2

    loop
next

If anyone could throw some advice my way, whether this is the approach that would be most conducive to my problem, or if there is an easier solution, it would be greatly appreciated.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:17:34+00:00Added an answer on May 26, 2026 at 1:17 pm

    Here is a function that will give you the column name based on its index:

    Private Function GetExcelColumnName(columnNumber As Integer) As String
        Dim col As Integer = columnNumber
        Dim columnName As String = ""
        Dim num As Integer
    
        While col > 0
            num = (col - 1) Mod 26
            columnName = Convert.ToChar(65 + num).ToString() & columnName
            col = CInt((col - num) \ 26)
        End While
    
        Return columnName
    End Function
    

    That should help you to create your average function strings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, I'll try to explain this the best I can. I have an iPhone
Alright i tried this last time and it was too vague so I'll try
Alright, so I'm trying out C++ for the first time, as it looks like
I'm creating an Asp.Net program UI where users can browse and change information in
Alright I'll try to explain my problem. Thanks for helping Simsoft. Frame 1 has
I have a table called orders this table contains all the information we need.
Alright, I am trying to accomplish this: When a user clicks a button that
Alright, I've been at this for days and can't seem to figure out what
Alright, I'll preface this with the fact that I'm a GTK and Python newb,
Alright, I'm trying to read a comma delimited file and then put that into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.