I want a formula using functions that I can put into a cell (I have much bigger ranges than in the examples below). If I had 3, ,4, ,5 in cells A1:A5, and I asked Excel to average them in B1, it would return 4 (by ignoring the blanks). What I have is ABEL,””,ABEL,””,ABEL in cells A1:A5. Note that two of the cells are empty strings. I want to “average” them in the sense that Excel would return ABEL as my answer. So, an answer to this problem would need to: 1) Return ABEL as the “average” for a range that has at least one ABEL in it, and any number of empty strings like “”, 2) Return an empty cell or “” as the “average” for any range that has no ABEL in it at all, and 3) Return something recognizable as an error (that I can filter) if I try to “average” a range that contains anything other than ABEL or empty strings like “”.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
“Average” a Range of Strings (Like They Were Numbers)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » “Average” a Range of Strings (Like They Were Numbers)
- This topic has 13 replies, 4 voices, and was last updated 13 years ago.
AuthorTopicWSboobounder
AskWoody LoungerMay 24, 2012 at 6:26 pm #483443Viewing 6 reply threadsAuthorReplies-
zeddy
AskWoody_MVPMay 25, 2012 at 7:28 am #1334099Hi
OK, lets forget about ‘average’ for a moment and break down what you seem to be asking for:
1. If you have a range that contains any cells with anything other than “” or “ABEL”, show an error message.
2. Otherwise, If your range contains at least one cell with “ABEL”, then the formula returns “ABEL”
3. Otherwise, if the range only contains “”, then the formula returns “”.So, essentially, what we need to do is:
1. Find out how many cells there are in the range, e.g. X
2. Find out how many cells are =””, e.g. Y
3. Find out how many cells are =”ABEL”, e.g. ZThen, IF X = Y + Z, then there are no other cell values, i.e. no error message required,
and if Z > 0 then you want “ABEL”.So, if your data range was say, A1:A25, youcould use this formula:
=IF((ROWS(A1:A25)-(COUNTIF(A1:A25,”ABEL”)+COUNTIF(A1:A25,””)))>0,”range contains unexpected data”,IF(COUNTIF(A1:A25,”ABEL”)>0,”ABEL”,””))..adjust range as required.
see attached workbook
zeddy
-
WSboobounder
AskWoody LoungerMay 25, 2012 at 1:51 pm #1334138This is a good approach to my problem …
But it runs into trouble if I don’t know what the text is going to be in a range.
So I need a formula that will look at a range, determine that it contains empty strings and one or more cells with “Abel” and return “Abel” — which your’s does — but be copyable to the next range where the string will be “Baker” and return “Baker”. But, if it’s copied to another cell, and the range its formula operates on contains “Charlie” and “Delta” it will return the error message.
-
WSboobounder
AskWoody LoungerMay 25, 2012 at 1:55 pm #1334139P.S. Sorry if my “average” metaphor didn’t work well.
What I meant was that I want something that would operate on 2, ,2, ,2 and return the average as 2.0 and operate on 2, ,2, ,3 and return 2.3. That would be easy to filter … by formula but also visually. I’m looking for the same sort of functionality on text strings.
-
-
WSsdckapr
AskWoody LoungerMay 25, 2012 at 2:11 pm #1334144So I need a formula that will look at a range, determine that it contains empty strings and one or more cells with “Abel” and return “Abel” — which your’s does — but be copyable to the next range where the string will be “Baker” and return “Baker”. But, if it’s copied to another cell, and the range its formula operates on contains “Charlie” and “Delta” it will return the error message.
You could put the “target value” of each row in a cell in that row and then use a formula which looks it up
What I meant was that I want something that would operate on 2, ,2, ,2 and return the average as 2.0 and operate on 2, ,2, ,3 and return 2.3.
But in your analogy you would get 2 for 2,2,2 but an error message for 2,2,3… so sorting would do not good: 2,2,3 and 2,2,4 and 3,3,4 and 5,5,10 would ALL give the same response of “error”
If you truly want an “average” why not put every possible text string you anticipate and assign it a value. Then have intermediate cells convert each string to its value and then average the converted values…
Steve
-
WSboobounder
AskWoody LoungerMay 26, 2012 at 1:06 am #1334180Thanks Steve.
I am talking about 2 different ideas in my query: average and “average”. This is why I keep using double quotes.
I sometimes use averaging as an error trap (other formulas too). In my example, doing an average on 5 cells (2, ,2, ,2) would yield 2, but doing it on (2, ,2, ,3) would yield 2.33 in general format. For a novice that would stand out as something different because of the different number of digits shown.
I want the same thing for a range of text. Thus an error trap that works like an average: thus, an “average”. I want:
“”,””,”” to yield “”
Abel,””,”” to yield Abel
“”,Baker,Baker to yield Baker
Charlie,Delta,”” to yield an error some error code (that I’ll tailor so as not to scare my user)If I had a similar pattern with numbers (and blank cells instead of empty strings), and used =average() as my error trap, it would work like this:
, , to yield a blank cell
2, , to yield 2
,3,3 to yield 3
4,5, to yield 4.5The great thing about using =average() as an error trap is that it works readily when copied.
Zeddy’s suggestion is very close to doing this for text … but it won’t copy readily because Abel is embedded in the formula that will be copied. I’d like to add the functionality to detect the string that is repeated in the range to Zeddy’s code that can report if there is a problem.
-
zeddy
AskWoody_MVPMay 26, 2012 at 9:16 am #1334223Hi
It would be easier, as Steve shows, if you already know what it is you are looking for.
However, on the basis you don’t know what you are searching for, i.e. it might not be “ABEL”, it could be any multiple occurence of some unknown text, like “FRED”, “RICHARD”,”ZEDDY” etc, then perhaps the attached solution is what you are looking for.
zeddy
-
WSsdckapr
AskWoody LoungerWSrory
AskWoody Lounger-
zeddy
AskWoody_MVPMay 28, 2012 at 5:11 am #1334484Hi rory
Yes, it does seem you can’t. Mostly.
But if you delete the value in A8, it still shows the answer in cell [E19].
And if you enter the formula =CONCATENATE(A1:A25) into another cell, it still returns JACK.
Instead of deleting cell [A8], if you type in FRED, you get the required message “range contains unexpected data”.
If you continue down and enter FRED for each cell that contained Jack, then when you enter the last FRED the formula changes from “range contains unexpected data” to the required “FRED”.zeddy
WSrory
AskWoody LoungerWSrory
AskWoody LoungerMay 28, 2012 at 5:24 am #1334485=CONCATENATE(A1:A25) is equivalent to =A1:A25
it returns an array of the cell values with no concatenation at all and what it returns to one cell will depend on how and where you enter it:
1. If you array enter it:
-in one cell and then copy or fill that anywhere, you will get the first entry
-in multiple cells, you will get the respective entries 1:n depending on how many cells you array enter into
2. if you enter it normally:
– in a cell in rows 1:25, you will get the item for that row
– in any other row you will get a #VALUE! error.-
zeddy
AskWoody_MVP
WSrory
AskWoody LoungerMay 28, 2012 at 6:36 am #1334491Viewing 6 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Windows 10 22H2 Update today (5 June) says up-to-date but last was 2025-04
by
Alan_uk
20 minutes ago -
Thoughts on Malwarebytes Scam Guard for Mobile?
by
opti1
3 hours, 28 minutes ago -
Mystical Desktop
by
CWBillow
3 hours, 42 minutes ago -
Meta and Yandex secretly tracked billions of Android users
by
Alex5723
6 hours, 24 minutes ago -
MS-DEFCON 2: Do you need that update?
by
Susan Bradley
50 minutes ago -
CD/DVD drive is no longer recognized
by
WSCape Sand
18 hours, 54 minutes ago -
Windows 11 24H2 Default Apps stuck on Edge and Adobe Photoshop
by
MikeBravo
21 hours, 44 minutes ago -
North Face and Cartier customer data stolen in cyber attacks
by
Alex5723
19 hours, 50 minutes ago -
What is wrong with simple approach?
by
WSSpoke36
12 hours, 21 minutes ago -
Microsoft-Backed Builder.ai Set for Bankruptcy After Cash Seized
by
Alex5723
1 day, 7 hours ago -
Location, location, location
by
Susan Bradley
1 hour, 3 minutes ago -
Cannot get a task to run a restore point
by
CWBillow
1 day, 8 hours ago -
Frustrating search behavior with Outlook
by
MrJimPhelps
23 hours, 24 minutes ago -
June 2025 Office non-Security Updates
by
PKCano
1 day, 19 hours ago -
Secure Boot Update Fails after KB5058405 Installed
by
SteveIT
15 hours, 50 minutes ago -
Firefox Red Panda Fun Stuff
by
Lars220
1 day, 19 hours ago -
How start headers and page numbers on page 3?
by
Davidhs
2 days, 5 hours ago -
Attack on LexisNexis Risk Solutions exposes data on 300k +
by
Nibbled To Death By Ducks
1 day, 8 hours ago -
Windows 11 Insider Preview build 26200.5622 released to DEV
by
joep517
2 days, 14 hours ago -
Windows 11 Insider Preview build 26120.4230 (24H2) released to BETA
by
joep517
2 days, 14 hours ago -
MS Excel 2019 Now Prompts to Back Up With OneDrive
by
lmacri
2 days, 4 hours ago -
Firefox 139
by
Charlie
1 day, 20 hours ago -
Who knows what?
by
Will Fastie
23 hours, 7 minutes ago -
My top ten underappreciated features in Office
by
Peter Deegan
2 days, 15 hours ago -
WAU Manager — It’s your computer, you are in charge!
by
Deanna McElveen
8 hours, 47 minutes ago -
Misbehaving devices
by
Susan Bradley
1 day, 10 hours ago -
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
3 days, 21 hours ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
19 hours, 59 minutes ago -
May 31, 2025—KB5062170 (OS Builds 22621.5415 and 22631.5415 Out-of-band
by
Alex5723
3 days, 19 hours ago -
Discover the Best AI Tools for Everything
by
Alex5723
2 days, 18 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.