ISNUMBER, MATCH, and SUMIFS

MrOllyR

New Member
Joined
Jun 24, 2020
Messages
24
Office Version
  1. 365
Platform
  1. Windows
I have a range F3:H12. In column F, I have students divided into languages groups, Column G names the groups. Column H says how many students are in each group.

NationalityGroupNumber of students
ItalianGroup 1
20​
ItalianGroup 2
20​
ItalianGroup 3
20​
ItalianGroup 4
20​
ItalianGroup 5
20​
ArabicGroup 6
20​
ChineseGroup 7
20​
ChineseGroup 8
20​
SpanishGroup 9
20​

Underneath this range I have a list of languages:
Italian
Turkish
Arabic
Chinese
French
Spanish
Portuguese

I want to replace each language in the table above with a formula which counts the total number of students who speak that language.
="Italian: " & SUMIFS(H3:H12,F3:F12, "Italian"). This works and reads, Italian: 100.

I want to add to the formula so if a language does not feature, like Portuguese, it leaves the cell blank. I have made this formula.
=IF(ISNUMBER(MATCH("Portuguese",F3:F12)),("Portuguese: "&SUMIFS(H3:H12,F3:F12,"Portuguese")), "")

It works in that it counts but still displays, Portuguese: , whether there are entries for Portuguese students or not.

Any ideas on how to fix this would be much appreciated.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try
=IF(ISNUMBER(MATCH("Portuguese",F$3:F$12,0)),("Portuguese: "&SUMIFS(H$3:H$12,F$3:F$12,"Portuguese")), "")

M.
 
Upvote 0
I have a range F3:H12. In column F, I have students divided into languages groups, Column G names the groups. Column H says how many students are in each group.

NationalityGroupNumber of students
ItalianGroup 1
20​
ItalianGroup 2
20​
ItalianGroup 3
20​
ItalianGroup 4
20​
ItalianGroup 5
20​
ArabicGroup 6
20​
ChineseGroup 7
20​
ChineseGroup 8
20​
SpanishGroup 9
20​

Underneath this range I have a list of languages:
Italian
Turkish
Arabic
Chinese
French
Spanish
Portuguese

I want to replace each language in the table above with a formula which counts the total number of students who speak that language.
="Italian: " & SUMIFS(H3:H12,F3:F12, "Italian"). This works and reads, Italian: 100.

I want to add to the formula so if a language does not feature, like Portuguese, it leaves the cell blank. I have made this formula.
=IF(ISNUMBER(MATCH("Portuguese",F3:F12)),("Portuguese: "&SUMIFS(H3:H12,F3:F12,"Portuguese")), "")

It works in that it counts but still displays, Portuguese: , whether there are entries for Portuguese students or not.

Any ideas on how to fix this would be much appreciated.
This is what I have come up with.

Put this formula in the first cell in the list and adjust the number 1 in ROW()-1 to equal the row number of the first cell minus 1.

So if this formula is put in row 2 then this would be the formula.

=IFERROR(INDEX(SORT(UNIQUE(Table2[Nationality])),ROW()-1) & " : " & SUM(FILTER(Table2[Number of students],Table2[Nationality]=INDEX(SORT(UNIQUE(Table2[Nationality])),ROW()-1))),"")

ROW()-1 appears twice in the formula.

Copy the formula down until you get a blank value returned. You dont need the formula in this cell.

DatePicker.xlsm
BCDEFG
1
2NationalityGroupNumber of studentsArabic : 20
3ItalianGroup 120Chinese : 40
4ItalianGroup 220Italian : 100
5ItalianGroup 320Spanish : 20
6ItalianGroup 420
7ItalianGroup 520
8ArabicGroup 620
9ChineseGroup 720
10ChineseGroup 820
11SpanishGroup 920
12
SumInTableVersion1
Cell Formulas
RangeFormula
G2:G5G2=INDEX(SORT(UNIQUE(Table2[Nationality])),ROW()-1) & " : " & SUM(FILTER(Table2[Number of students],Table2[Nationality]=INDEX(SORT(UNIQUE(Table2[Nationality])),ROW()-1)))
 
Upvote 0
This is what I have come up with.

Put this formula in the first cell in the list and adjust the number 1 in ROW()-1 to equal the row number of the first cell minus 1.

So if this formula is put in row 2 then this would be the formula.

=IFERROR(INDEX(SORT(UNIQUE(Table2[Nationality])),ROW()-1) & " : " & SUM(FILTER(Table2[Number of students],Table2[Nationality]=INDEX(SORT(UNIQUE(Table2[Nationality])),ROW()-1))),"")

ROW()-1 appears twice in the formula.

Copy the formula down until you get a blank value returned. You dont need the formula in this cell.

DatePicker.xlsm
BCDEFG
1
2NationalityGroupNumber of studentsArabic : 20
3ItalianGroup 120Chinese : 40
4ItalianGroup 220Italian : 100
5ItalianGroup 320Spanish : 20
6ItalianGroup 420
7ItalianGroup 520
8ArabicGroup 620
9ChineseGroup 720
10ChineseGroup 820
11SpanishGroup 920
12
SumInTableVersion1
Cell Formulas
RangeFormula
G2:G5G2=INDEX(SORT(UNIQUE(Table2[Nationality])),ROW()-1) & " : " & SUM(FILTER(Table2[Number of students],Table2[Nationality]=INDEX(SORT(UNIQUE(Table2[Nationality])),ROW()-1)))
You will need to change Table2 to the name of your table.

The list is in alphabetical order.
 
Upvote 0

Forum statistics

Threads
1,215,086
Messages
6,123,035
Members
449,092
Latest member
ikke

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