Jan 24 2023 07:15 AM
I'm trying to enter the MAXIFS function in E2, but Excel doesn't recognize the formula. Thanks for any help you can offer.
Jan 24 2023 07:36 AM
Jan 24 2023 08:48 AM
First parameter shall be the range, not formula. Convert first column into dates first.
Jan 24 2023 09:54 AM
Thanks, Sergei. VisitDateText, GearE, and SurvE are named ranges in the VisitData worksheet. Many cells in those named ranges are blank in this workbook. The VisitDate named range in the LF worksheet converts the text to a DATEVALUE. It seems the #VALUE results in VisitDate are causing the MAXIFS function in Q6 to return zero.
Jan 25 2023 06:49 AM
Formula in Q6 is
=MAXIFS(VisitDate,GearE,"BOOM SHOCKER",SurvE,$B$3)
we try to find max on VisitDate. The latest returns array of texts with some zeroes at the end which correspond to blank cells in the source. MAXIFS ignores texts and returns max from numbers. 0 in our case or 1900-01-00 in date format.
Not to be dependant on locale I converted texts to dates as
=DATE(RIGHT(VisitDateText,4), LEFT(VisitDateText,2), MID(VisitDateText,4,2) )
which correctly returns dates. If MAXIFS on that spill it returns some date.
Please check in attached.
Jan 25 2023 09:02 AM
T6 and T8 show that the =DATEVALUE conversion in P6 produced the same result as the =DATE conversion in R6. Using a named range in the MAXIFS formula seems to cause the problem. See T10:T13 in attachment. VisitDate has the same size and shape as GearE and SurvE.
Jan 25 2023 09:27 AM
I converted FishData!P:P with dates as texts into real data in FishData!BH:BH. In LF sheet reference is changed accordingly
VisitDate remains the same
Now use it in formula, it works
The only difference VisitDate now returns correctly converted dates, not texts.
Jan 25 2023 12:05 PM
The MAXIFS result 05/07/1962 is incorrect because criteria2 (SurvE,$B$3) has only dates in 2022.
The text to date conversion should be on VisitDateText in VisitData!M:M, not FishData!P:P. I have a mistake in the reference for VisitDate.
Jan 25 2023 12:45 PM
SolutionMaybe, I'm not sure which ranges are to be taken. That was only to illustrate that named range causes no error with MAXIFS if only it returns correct data. In our case that shall be dates, not texts as with your variant.
To be sure you may return spill such named range at any place and check with ISTEXT() do you have texts or dates.
Jan 25 2023 02:05 PM
My entire problem is traced back to my mistake in the reference to the range named VisitDate. With that reference correct now, MAXIFS gives correct result for both text to date conversions in LF!P:P and LF!R:R. I wanted to attach a final copy, but maybe there is a limit. Thank you for your help with this
Jan 25 2023 12:45 PM
SolutionMaybe, I'm not sure which ranges are to be taken. That was only to illustrate that named range causes no error with MAXIFS if only it returns correct data. In our case that shall be dates, not texts as with your variant.
To be sure you may return spill such named range at any place and check with ISTEXT() do you have texts or dates.