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 12 years, 11 months 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 Lounger -
WSrory
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 Lounger -
WSrory
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 #1334491
Viewing 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
-
Auto Time Zone Adjustment
by
wadeer
2 hours, 50 minutes ago -
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
29 minutes ago -
Manage your browsing experience with Edge
by
Mary Branscombe
8 hours, 40 minutes ago -
Fewer vulnerabilities, larger updates
by
Susan Bradley
26 minutes ago -
Hobbies — There’s free software for that!
by
Deanna McElveen
1 hour, 5 minutes ago -
Apps included with macOS
by
Will Fastie
31 minutes ago -
Xfinity home internet
by
MrJimPhelps
13 hours, 32 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
1 hour, 45 minutes ago -
Debian 12.11 released
by
Alex5723
23 hours, 58 minutes ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
1 day, 3 hours ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
7 hours, 6 minutes ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
1 day ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
1 day, 20 hours ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
1 day, 10 hours ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
1 day, 23 hours ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
1 day, 15 hours ago -
Some advice for managing my wireless internet gateway
by
LHiggins
23 hours, 3 minutes ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
1 hour, 1 minute ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
2 days, 8 hours ago -
Sometimes I wonder about these bots
by
Susan Bradley
2 days, 5 hours ago -
Does windows update component store “self heal”?
by
Mike Cross
1 day, 19 hours ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
2 days, 22 hours ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
1 day, 6 hours ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
19 hours, 17 minutes ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
3 days, 1 hour ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
3 days, 1 hour ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
2 days, 13 hours ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
3 days, 9 hours ago -
0Patch, where to begin
by
cassel23
3 days, 3 hours ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
3 days, 23 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.