Counting multiple answers from Forms

Katarnnl

New Member
Joined
Jun 27, 2023
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have exported the results of several identical surveys I conducted in Forms and are now trying to combine and analyse the results in Excel. However I get stuck at the responses with multiple answer categories. After using a pivottable on the results, the outcome in Excel show up like this:

ResponseCount
answer1;answer25
answer1;answer3;other1
answer1;answer2;answer33
other1
answer3;answer12

The issue is that the "other" answer is whatever text the respondent put there. Using SUMIF formulas, I have been able to count the number of answer1, answer2, etc. But I cannot find a way yet to count the "other" answers.

Currently I do not really care what exact text the respondent included, I just want to count the number of respondent who answered anything other than answer1, answer2, etc. So the result I am looking for should look like this:

ResponseCount
answer111
answer28
answer36
other2

Anyone any ideas on this one?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
MrExcelPlayground18.xlsx
AB
1ResponseCount
2answer1;answer25
3answer1;answer3;other1
4answer1;answer2;answer33
5other1
6answer3;answer12
7
8
9answer111
10answer28
11answer36
12other2
Sheet12
Cell Formulas
RangeFormula
A9:B12A9=LET(a,DROP(TEXTSPLIT(TEXTJOIN("",TRUE,REPT(A2:A6&";",B2:B6)),,";"),-1),b,TRANSPOSE(SORT(UNIQUE(a))),c,--(a=b),d,BYCOL(c,LAMBDA(col,SUM(col))),TRANSPOSE(VSTACK(b,d)))
Dynamic array formulas.
 
Upvote 1
MrExcelPlayground18.xlsx
AB
1ResponseCount
2answer1;answer25
3answer1;answer3;other1
4answer1;answer2;answer33
5other1
6answer3;answer12
7
8
9answer111
10answer28
11answer36
12other2
Sheet12
Cell Formulas
RangeFormula
A9:B12A9=LET(a,DROP(TEXTSPLIT(TEXTJOIN("",TRUE,REPT(A2:A6&";",B2:B6)),,";"),-1),b,TRANSPOSE(SORT(UNIQUE(a))),c,--(a=b),d,BYCOL(c,LAMBDA(col,SUM(col))),TRANSPOSE(VSTACK(b,d)))
Dynamic array formulas.

Ok, wow! This is far beyond my area of expertise. But most important, it works.

However, I would like to ask you if you could make 1 change for me. I included an example in my question, but in the real-life case, every answer ends with a semicolon. So the first row of my example would be "answer1;answer2;". Using your formula, it now includes an additional row, counting all the empty spaces after the last semicolon. I could of course just ignore it, but if there is a solution, that would be awesome!
 
Upvote 0
The good thing about LET, you can change the output variable to see how the 'build" works.


MrExcelPlayground18.xlsx
AB
1ResponseCount
2answer1;answer2;5
3answer1;answer3;other;1
4answer1;answer2;answer3;3
5other;1
6answer3;answer1;2
7
8
9answer111
10answer28
11answer36
12other2
Sheet12
Cell Formulas
RangeFormula
A9:B12A9=LET(a,DROP(TEXTSPLIT(TEXTJOIN("",TRUE,REPT(A2:A6,B2:B6)),,";"),-1), b,TRANSPOSE(SORT(UNIQUE(a))), c,--(a=b), d,BYCOL(c,LAMBDA(col,SUM(col))), e,TRANSPOSE(VSTACK(b,d)), e)
Dynamic array formulas.
 
Upvote 0
MrExcelPlayground18.xlsx
AB
1ResponseCount
2answer1;answer25
3answer1;answer3;other1
4answer1;answer2;answer33
5other1
6answer3;answer12
7
8
9answer111
10answer28
11answer36
12other2
Sheet12
Cell Formulas
RangeFormula
A9:B12A9=LET(a,DROP(TEXTSPLIT(TEXTJOIN("",TRUE,REPT(A2:A6&";",B2:B6)),,";"),-1),b,TRANSPOSE(SORT(UNIQUE(a))),c,--(a=b),d,BYCOL(c,LAMBDA(col,SUM(col))),TRANSPOSE(VSTACK(b,d)))
Dynamic array formulas.
Ok, wait, hold your horses. I was a little bit too fast!

This is a very workable option, but I now notice using it in the real-life case, that it sums up all the unique answers. Which is great, but it should categorize all other answers as 1 item. My fault, my example was not clear on this.

So the answers I have look like this:
ResponseCount
answer1;answer2;5
answer1;answer3;random;1
answer1;answer2;answer3;3
text1
answer3;answer1;more random2

The result I want to see is:
answer111
answer28
answer36
other3

So I have a number of options which are always the same (answer1, answer2, etc), and then I have all the random text inserted by respondents when they choose the "other" option.
 
Upvote 0
MrExcelPlayground18.xlsx
ABCD
1ResponseCountMain Answers
2answer1;answer2;5answer1
3answer1;answer3;random;1answer2
4answer1;answer2;answer3;3answer3
5text;1
6answer3;answer1;more random;2
7
8
9answer111
10answer28
11answer36
12other4
Sheet12
Cell Formulas
RangeFormula
A9:B12A9=LET(a,DROP(TEXTSPLIT(TEXTJOIN("",TRUE,REPT(A2:A6,B2:B6)),,";"),-1), z,D2:D4, aa,IF(ISNUMBER(XMATCH(a,z,0)),a,"other"), b,TRANSPOSE(SORT(UNIQUE(aa))), c,--(aa=b), d,BYCOL(c,LAMBDA(col,SUM(col))), e,TRANSPOSE(VSTACK(b,d)), e)
Dynamic array formulas.
 
Upvote 0
Solution
MrExcelPlayground18.xlsx
ABCD
1ResponseCountMain Answers
2answer1;answer2;5answer1
3answer1;answer3;random;1answer2
4answer1;answer2;answer3;3answer3
5text;1
6answer3;answer1;more random;2
7
8
9answer111
10answer28
11answer36
12other4
Sheet12
Cell Formulas
RangeFormula
A9:B12A9=LET(a,DROP(TEXTSPLIT(TEXTJOIN("",TRUE,REPT(A2:A6,B2:B6)),,";"),-1), z,D2:D4, aa,IF(ISNUMBER(XMATCH(a,z,0)),a,"other"), b,TRANSPOSE(SORT(UNIQUE(aa))), c,--(aa=b), d,BYCOL(c,LAMBDA(col,SUM(col))), e,TRANSPOSE(VSTACK(b,d)), e)
Dynamic array formulas.

This is really perfect. Thank you so much!
 
Upvote 0
You're welcome. I like it when some of the real all-stars come in and do the same thing with half the formula. It's amazing what some of them can do. I learn tons from that when I can unpack what they are up to, and learn all kinds of uses for usually the new formulas. I learned the practical use of LAMBDAs that way.
 
Upvote 0
You're welcome. I like it when some of the real all-stars come in and do the same thing with half the formula. It's amazing what some of them can do. I learn tons from that when I can unpack what they are up to, and learn all kinds of uses for usually the new formulas. I learned the practical use of LAMBDAs that way.

It seems I'm running into a new issue. I get a #CALC! error, telling me: TEXTJOIN: Text too long

I tried to shorten several of the answer categories, but I still get the error. Any ideas how I can solve this one?
 
Upvote 0
I think a textjoin can only be about 32,000 characters long. Is your list much bigger than that?
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top