Ask Your Question

Minif and Maxif function in calc

asked 2015-12-24 01:34:33 +0100

Thorniestmax gravatar image

updated 2015-12-24 12:39:10 +0100

Alex Kemp gravatar image

On sheet one, I have a list of URLs, with duplicates in column B. In column J, I have dates visited. On sheet two, I have a list of all the URLs from sheet 1, with no duplicates.

On sheet two, I want to lookup the highest date that a URL from sheet one matching the url from sheet two in one column, and the earliest date in another. Something like:


URL|Most recent update|first checked [url]|=maxif(S1.B2:B25001,a2,S1.J2:J25001)|=minif(S1.B2:B25001,a2,S1.J2:J25001)

I realize that there is no minif or maxif functions (or if there are, I haven't found them), but if someone could show me a way to implement something that would work in the same way as they might work, I would really appreciate it.

Oh yeah: Fully updated English language Windows 7 x64 Ultimate edition with Japanese locale, using LibreOffice v4.4.4.3 Calc with en_US locale.

Had no idea what tags I was supposed to use, so please forgive me if I used the wrong ones.

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted

answered 2015-12-24 12:04:40 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.


May be a solution in MinIfMaxIf.ods


I forgot some explanations:

  • Most recent update (e.g. Sheet2.B2) is an array formula: needs key combination Shift+Ctrl+Enter
  • To copy down with fill handle in the bottom right corner of the cell, needs to hold down the Ctrl key


edit flag offensive delete link more

answered 2017-11-24 12:33:33 +0100

erAck gravatar image

updated 2017-11-24 12:33:56 +0100

Version 4.4 is quite outdated.. it might be interesting to you that some later version introduced the MAXIFS and MINIFS spreadsheet functions.

edit flag offensive delete link more


I'm using Ubuntu 16.04 (i. e. the current LTS distribution) which installs Libreoffice which still doesn't have an MAXIFS() :-(

Alfe gravatar imageAlfe ( 2017-11-24 12:39:46 +0100 )edit

True, were introduced with LibreOffice 5.2. On Ubuntu you can use a PPA.

erAck gravatar imageerAck ( 2017-11-24 12:47:38 +0100 )edit

answered 2017-11-24 12:13:15 +0100

Alfe gravatar image

updated 2017-11-24 13:02:16 +0100

The other answer given here (alas, I cannot see the author's name—weird) nudged me into the right direction. But by specifying a thing like MAX(ROW($Sheet1.$B$2:$B$13)*($Sheet1.$A$2:$A$13=A2)) it only takes the value furthest down (by computing the maximum if the row number). Since in this case the dates are sorted and later ones are indeed further down, this works as well. This might not be the case in other scenarios (as it was in mine).

To really get the maximum of a list of values for which a selector next to it matches a criterion (which would be a true MAXIF()), one can use a formula like this:

=MAX(IF($Sheet1.$A$2:$A$13=A2, $Sheet1.$B$2:$B$13, 0))

And, again: Don't forget to press CTRL-SHIFT-Enter in order to have this code be interpreted as an array function.

Mind also, that this will make all values for which the criterion doesn't match just 0 (which in many cases will not end up to be the maximum). If you, however, try to find the maximum of a bunch of negative numbers, this will fail because then the maximum will be any of the zeros. You need to use a value lower than any of yours:

=MAX(IF($Sheet1.$A$2:$A$13=A4, $Sheet1.$B$2:$B$13, -693595))

(The -693595 being the number for the date 0001-01-01 which is probably before any date you are dealing with.)

edit flag offensive delete link more

answered 2017-11-24 12:51:57 +0100

Lupp gravatar image

Since V5.2 (first released week 31, 2016; see here) there are implemented the functions MAXIFS() and MINIFS(). Unfortunately there are not yet (V5.4.3) the respective offline help texts. You need to resort to the function wizard to be guided. (This actually is clear enough.)
(The mentioned functions are not yet specified in "OpenFormula". They were introduced for better compatibility with recent versions of MS-Excel and are expected to work in the same way as SUMIFS and AVERAGEIFS concerning the conditions given as a pair of a range and a criterion each, while the range to get the data from is given as the first parameter.)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-12-24 01:34:33 +0100

Seen: 2,278 times

Last updated: Nov 24 '17