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 8558477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:49:14+00:00 2026-06-11T15:49:14+00:00

I don’t know if this question will make sense to begin with… Example Given:

  • 0

I don’t know if this question will make sense to begin with…

Example Given: the following value is given for a single cell (we’ll call it A1): Sub-value #1|Here's another sub-value #2|Yet again, last but not least, sub-value #3. I already know someone will tell me that this is where a database should be used (trust me, my major is DB Management, I know, but I need my data in this fashion). My delimiter is the |. Now say I want to create a function that will take the LEN() of each sub-value and return the AVERAGE() of all the sub-values. If I wanted to create a single function to do this, I could use an split(), take each value, do an LEN() and return the AVERAGE().

For the example given, let’s utilize cell B1. I have created similar functions in the past that would work by the following method (although not this exact one), but it requires splitting and joining the array/cell value(s) each time: =ARRAY_AVERAGE(ARRAY_LEN(A1,"|","|"),"|","|").

  • ARRAY_LEN(cell,delimiter[,Optional new_delimiter])
  • ARRAY_AVERAGE(cell,delimiter[,Optional new_delimiter])

However, I’m wondering if there might be a more dynamic approach to this. Basically, I want to split() an array with some custom VBA function, pass it to parent cell functions, and I wrap up the array by a function that will merge the array back together.

Here’s how the cell function will run:
=ARRAY_AVERAGE(ARRAY_LEN(ARRAY_SPLIT(A1,"|"))).

  • ARRAY_SPLIT(cell,delimiter) will split the array.
  • ARRAY_LEN(array) will return the length of each sub-value of the array.
  • ARRAY_AVERAGE(array) will return the average of each sub-value of the array. Since this function returns a single value of multiple values, this will take the form of an imaginary ARRAY_JOIN(array,delimiter) that would merge the array back again.

This requires one or two additional functions in the cells, but it also lowers the number of iterations that the cell would be converting to and from a single cell value and VBA array.

What do you think? Possible? Feasible? More or less code efficient?

  • 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-06-11T15:49:15+00:00Added an answer on June 11, 2026 at 3:49 pm

    Here are 2 example VBA UDFs that work on a single cell: enter the formula as

    =AVERAGE(len_text(SPLIT_TEXT(A1,”|”)))

    Note that in this particular case you don’t actually need the len_text function, you could use Excel’s LEN() instead, but then you would have to enter the AVERAGE(..) as an array formula.

    Option Explicit
    
    Public Function Split_Text(theText As Variant, Delimiter As Variant) As Variant
        Dim var As Variant
        var = Split(theText, Delimiter)
        Split_Text = Application.WorksheetFunction.Transpose(var)
    End Function
    Public Function Len_Text(something As Variant) As Variant
        Dim j As Long
        Dim k As Long
        Dim var() As Variant
    
        If IsObject(something) Then
            something = something.Value2
        End If
    
        ReDim var(LBound(something) To UBound(something), LBound(something, 2) To UBound(something, 2))
        For j = LBound(something) To UBound(something)
            For k = LBound(something, 2) To UBound(something, 2)
                var(j, k) = Len(something(j, k))
            Next k
        Next j
        Len_Text = var
    
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't know if this has been asked before, so point me to another question
I don't know if this question is trivial or not. But after a couple
Don't know if this is the right place to ask this, but I will
Don't know if I worded the question right, but basically what I want to
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know if anyone can help me with this or if it's even possible.
I don't know: if this works. if it's a good idea. what it is
Don't know why this doesn't work. I can't do implicit animation for a newly
Don't know why this is happening, but after submitting a form via JS (using
Don't know what to do with this error. How to add data in SQL

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.