Excel tutorial
/

Functions

Intermediate

Excel MAXIFS and MINIFS: the largest and smallest value by condition

MAXIFS and MINIFS find the largest and smallest value that meets your conditions: last purchase date, best price, and the trap of returning 0.

MAXIFS returns the largest value among rows that meet the conditions, and MINIFS returns the smallest. They are the “filtered” versions of MAX and MIN.

Questions: “What is Aziz’s biggest sale?”, “When did this client last buy?” (a date is a number too — the largest is the latest), “Where can we buy sugar cheapest?”. These used to require complex array formulas; now it’s one function.

MAXIFS and MINIFS are available in Excel 2019 and Microsoft 365.

Книга1 - Excel
—☐✕
F2fx=МАКСЕСЛИ(D2:D8;B2:B8;"Aziz")
ABCDEFG
1DateManagerCityAmountQuestionAnswer
203.01.2025AzizTashkent1 250 000Aziz: largest1 250 000
310.01.2025DilnozaSamarkand640 000Aziz: smallest480 000
418.01.2025JavohirTashkent2 100 000
527.01.2025AzizTashkent910 000
604.02.2025DilnozaSamarkand1 730 000
711.02.2025AzizTashkent480 000
818.02.2025JavohirTashkent1 500 000
9
Готово
Of Aziz’s three sales — the largest (green) and the smallest (red). Javohir’s 2.1 mln sale is not counted

Syntax

=МАКСЕСЛИ(max_range; criteria_range1; criteria1; [criteria_range2; criteria2]; ...)

=МИНЕСЛИ(min_range; criteria_range1; criteria1; [criteria_range2; criteria2]; ...)

  • max_range / min_range — the numbers to search for the largest or smallest: D2:D8. It comes first — just like in SUMIFS.
  • criteria_range1, criteria1 — the first condition: B2:B8, "Aziz".
  • criteria_range2, criteria2 … — extra conditions, up to 126 pairs.

Conditions are joined with “and”, and the ranges must be the same size. Conditions are written as in COUNTIFS: ">0", ">="&F1, "Tash*".

Step by step: entering MAXIFS

1

Select F2 for the result.

2

Формулы → Вставить функцию → type MAXIFS in the search box (category Statistical) and click OK.

Книга1 - Excel
—☐✕
ФайлГлавнаяВставкаРазметка страницыФормулыДанныеРецензированиеВидСправка
Вставить функциюАвтосуммаФинансовыеЛогическиеТекстовыеДата и времяСсылки и массивыМатематические
Библиотека функций
Диспетчер имён
Определённые имена
F2fx
ABCDEFG
1DateManagerCityAmountQuestionAnswer
203.01.2025AzizTashkent1 250 000Aziz: largest
310.01.2025DilnozaSamarkand640 000
4
5
Готово

3

Max_range — D2:D8, Criteria_range1 — B2:B8, Criteria1 — "Aziz". Click OK.

Книга1 - Excel
—☐✕
F2fx
ABCDEFG
1DateManagerCityAmountQuestionAnswer
203.01.2025AzizTashkent1 250 000Aziz: largest
310.01.2025DilnozaSamarkand640 000
4
5
Готово

4

The result is 1,250,000. MINIFS is entered the same way: =МИНЕСЛИ(D2:D8;B2:B8;"Aziz").

Example 1: each client’s last purchase

A date is a number, so the largest date is the latest. MAXIFS finds the last purchase day for each client in the date column:

=МАКСЕСЛИ($A$2:$A$8;$B$2:$B$8;E2)

Give the result cell a date format — otherwise you’ll see a number like 45699. The first purchase comes from MINIFS, and days since the last one from =СЕГОДНЯ()-МАКСЕСЛИ(…). That’s how you spot clients who haven’t bought in a while.

Книга1 - Excel
—☐✕
F2fx=МАКСЕСЛИ($A$2:$A$8;$B$2:$B$8;E2)
ABCDEFG
1DateClientAmountClientLast purchase
203.01.2025Oila Market1 250 000Oila Market11.02.2025
311.01.2025Baraka Trade640 000Baraka Trade04.02.2025
418.01.2025Oila Market2 100 000Nur Shop18.02.2025
527.01.2025Nur Shop910 000
604.02.2025Baraka Trade1 730 000
711.02.2025Oila Market480 000
818.02.2025Nur Shop1 500 000
9
Готово
The latest date for each client. Column F has the dd.mm.yyyy format

Example 2: the best price — ignoring zeros

In a supplier price table, 0 means “no offer”. Plain MINIFS returns exactly that zero as the “lowest price”. Add a condition on the price column itself:

=МИНЕСЛИ(C2:C7;A2:A7;"Sugar";C2:C7;">0")

Книга1 - Excel
—☐✕
F3fx=МИНЕСЛИ(C2:C7;A2:A7;"Sugar";C2:C7;">0")
ABCDEFG
1ProductSupplierPrice, 1 kgQuestionAnswer
2SugarAgro Trade13 500Sugar (plain)0
3SugarUlgurji Plus0Sugar (>0)12 900
4SugarSharq Savdo12 900Flour (>0)7 800
5FlourAgro Trade7 800
6FlourUlgurji Plus8 200
7FlourSharq Savdo0
8
Готово
Plain MINIFS says “0 soum” — that’s a missing offer, not a bargain. With ">0" the real best price is 12,900
Книга1 - Excel
—☐✕
F2fx=МАКСЕСЛИ(D2:D8;B2:B8;"Bobur")
ABCDEFG
1DateManagerCityAmountVersionResult
203.01.2025AzizTashkent1 250 000Bobur (none)0
310.01.2025DilnozaSamarkand640 000Guarded—
418.01.2025JavohirTashkent2 100 000
527.01.2025AzizTashkent910 000
604.02.2025DilnozaSamarkand1 730 000
711.02.2025AzizTashkent480 000
818.02.2025JavohirTashkent1 500 000
9
Готово
Bobur isn’t in the list, yet MAXIFS shows 0 instead of an error. The guarded version shows “—”

Pro level: who? when? how wide is the spread?

  • Who made the biggest sale? MAXIFS gives the value; a lookup gives the name: =ПРОСМОТРX(МАКСЕСЛИ(D2:D8;C2:C8;"Tashkent");D2:D8;B2:B8). Careful: if the same amount also appears in another city, XLOOKUP takes the first match. A robust version (Microsoft 365): =ПРОСМОТРX(1;(C2:C8="Tashkent")*(D2:D8=МАКСЕСЛИ(D2:D8;C2:C8;"Tashkent"));B2:B8).
  • The spread. =МАКСЕСЛИ(…)-МИНЕСЛИ(…) — the gap between the largest and smallest order in a city.
  • A record for a period. =МАКСЕСЛИ(D2:D8;A2:A8;">="&ДАТА(2025;2;1)) — the largest sale since the start of February.
  • Last activity. =СЕГОДНЯ()-МАКСЕСЛИ(A:A;B:B;E2) — how many days a client hasn’t bought; over 30 means it’s time to call.
Книга1 - Excel
—☐✕
F3fx=ПРОСМОТРX(МАКСЕСЛИ(D2:D8;C2:C8;"Tashkent");D2:D8;B2:B8)
ABCDEFG
1DateManagerCityAmountQuestionAnswer
203.01.2025AzizTashkent1 250 000Tashkent: max2 100 000
310.01.2025DilnozaSamarkand640 000Who?Javohir
418.01.2025JavohirTashkent2 100 000Max − min1 620 000
527.01.2025AzizTashkent910 000February record1 730 000
604.02.2025DilnozaSamarkand1 730 000
711.02.2025AzizTashkent480 000
818.02.2025JavohirTashkent1 500 000
9
Готово
Tashkent’s record is Javohir’s 2.1 mln sale. February’s record, though, comes from Samarkand

Try it in the simulator

Type =МАКСЕСЛИ(D2:D8;B2:B8;"Aziz") in F2. Then in F3 find the smallest order in Tashkent: =МИНЕСЛИ(D2:D8;C2:C8;"Tashkent").

Книга1 - Excel
—☐✕
Буфер обмена
Шрифт
Выравнивание
Число
Стили
Ячейки
Редактирование
✕✓fx
ABCDEFGHIJKLMNOPQRSTUVWX
1DateManagerCityAmountQuestionAnswer
245660AzizTashkent1250000Aziz: largest
345667DilnozaSamarkand640000Tashkent: smallest
445675JavohirTashkent2100000
545684AzizTashkent910000
645692DilnozaSamarkand1730000
745699AzizTashkent480000
845706JavohirTashkent1500000
9
10
11
12
Лист1
Готово

Has ExcelLab been useful?

Support the project and help us release new lessons and exercises.

Support us
Previous

92 / 154