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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:26:03+00:00 2026-06-18T12:26:03+00:00

I have an array of alphanumeric data used in application testing, and for certain

  • 0

I have an array of alphanumeric data used in application testing, and for certain reasons I need to calculate a sum of occurrences of letters from “a” to “f” in each string (this will be used for further data processing):

02599caa0b600 --> should be 4
489455f183c1fb49b --> should be 5
678661081c1h
66410hd2f0kxd94f5bb
8a0339a4417
f6d9f967ts4af6e
886sf7asc3e85ec
03f1fhh3c3a2am
e491b17638m60
1m8h2m07bhaa4tnhbc4
29ma900a80m96m65
ca6a75f505tsac8
956828db8ts7fd1d
cf1d220a59a7851180e
a8b7852xd9e7a9
b85963fbe30718db9976
39b8kx8f85abb1b6
0xxb3b648ab
a8da75f730d45048
588h69d344

This is what strings look like, their length is about 10-30 symbols, and I suppose to have about 3-5k of them daily for processing. Assumptions and limitations:

  1. Case of letters does NOT matter (happily).
  2. The list of letters may change one day, but very much likely still remains a range, e.g. a-k, d-g, etc. – therefore solution should be as much flexible as possible.
  3. Any temporary calculations / ranges are not prohibited, but the shorter the better.
  4. I’d prefer pure Excel solution, but in case it’s too complicated – VBA still an option. Nevertheless, complicated Excel formula is better than “2-lines-of-code” VBA – if the 1st works as expected.

Things I’ve tried so far (as I noticed, that practice here is very much welcome):

  • Searched through already answered questions, but found no Excel-based solutions for anything similar. Other languages / approaches are not an option (except VBA).
  • The best thing I got on my own so far are nested SUBSTITUTE functions, but it’s dirty and very straightforward. Assuming the range may change to c-x that’ll be a nightmare.
  • I’m not a newbie to Excel, but things like complicated array formulas are still hard nuts for me – alas but true…

Anyway, I do not ask for “ready-to-go” “out-of-box” solution – I ask for help and right direction / approach for self-learning and further understanding of similar problems.

  • 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-18T12:26:04+00:00Added an answer on June 18, 2026 at 12:26 pm

    Here’s my option – pretty similar to already posted, but anyway… especially if you’re interested in learning, which is so rare today)

    Assuming you have your list starting A2, use the following array formula:

    =SUM(LEN($A2)-LEN(SUBSTITUTE($A2,CHAR(ROW(INDIRECT(CODE("a")&":"&CODE("f")))),"")))
    

    Just as reminder – press CTRL+SHIFT+ENTER instead of usual ENTER.

    Some explanations:

    1. Range of letters a-f is generated using char codes of range edges, transformed back to the array of chars using CHAR(ROW(INDIRECT(...))) structure.
    2. Then “nightmare” comes to help, finally summarizing the obtained numbers of substituted vs original string subtractions.
    3. Thus, in case of such double conversion you do not need codetable)))

    And two more similar “nuts” samples – just for learning purposes.

    In case you need to summarize all digits matches – you still may use the above using 0 and 9 as input (digits are chars with 48 to 57 codes starting 0). However, the following more simple solution will go as well:

    =SUM(LEN($A2)-LEN(SUBSTITUTE($A2,ROW($1:$10)-1,"")))
    

    The trick here is that we may generate numbers 0-9 using array or row numbers 1-10 minus 1 – ROW(0) would generate an error.

    Finally, if you need to calculate a sum of all digits in the string – use this:

    =SUM(IFERROR(VALUE(MID($A2,ROW(INDIRECT("1:"&LEN($A2))),1)),0))
    

    Here we disintegrate the initial string to letters using MID for every single char, and then test it against being a number using IFERROR and returning 0 for anything but digit.

    Last 2 are (obviously) your beloved array nuts)))

    I use the above samples in my Excel training for QA stuff (by the way welcome to SE, colleague!), thus demonstrating typical functions / approaches for nuts cracking. Hope that was useful for you as well. However, all the previous answers deserve at least your fair upvote, especially @barry’s nuts-free recipe)

    For your convenience sample file is shared: https://www.dropbox.com/s/qo5k479oyawkrzh/SumLettersCount.xlsx

    Good luck with your testing)

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

Sidebar

Related Questions

I have array of strings, String[] data and it's 10 elements has value P
What I'm looking to do is split data from string into an array. Here's
I have code $this->addValidator('Regex', false, array('/^[A-Za-z0-9 _]*[A-Za-z0-9][A-Za-z0-9 _]*$/')); which is used to validate if
I have array with alphanumeric key values..While filling array on particular condition I have
I have problem with latin chars, here is the code: $stopWords = array('i','a','about','an','and','are','as','at','be','by','com','de','en','for','from','how','in','is','it','la','of','on','or','that','the','this','to','was','what','when','where','who','will','with','und','the','www', 'on',
I have a array of data: ! A B E $ N I'd like
I have numbers in an array list which also contains alphanumeric. For example. 1
I have array number = {2,3,4,5,6} Now i have to select rows from table
I have an array that contains some UTF-8 characters from different languages. Every entry
I have array like below array(1) { [data]=> array(6) { [0]=> array(2) { [name]=>

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.