Index/Match find Max Date UNLESS matching range contains Nulll (blank)..

Galena1

Active Member
Joined
Jun 10, 2010
Messages
305
Ok, I have a table with 3 columns: Parent ID, Record ID, and Approved On Date.

I want to find the MAX Date for Parent ID. For example 201999 MAX date is 3-Jun-2014.
However, if the Record ID contains blanks (nulls) in the Approved On field, then I want formula to return "", or blank.
Example: Parent ID 209264 has eight matching records. The MAX date however would be reported as null or blank, because
three of the Approved On dates are null or blank.

This is what I am using now, but it doesn't take into account the blank date condition.

=MAX(INDEX($L$10:$M$10240,MATCH(T10,$K$10:$K1000,2),2))

Thanks in advance for any help. :LOL:
Parent ID 199581
201999
201999
201999
202496
202741
202741
204232
204599
204599
206745
206745
206994
207219
207219
209264
209264
209264
209264
209264
209264
209264
209264

<TBODY>
</TBODY>
Record ID 205332
206951
206959
207556
213546
212785
212788
213022
209578
209826
216579
216590
211467
213041
213046
214584
214591
214595
214597
214608
214614
214615
214617

<TBODY>
</TBODY>
Approved On
31-Jul-2014</SPAN>
28-May-2014</SPAN>
3-Jun-2014</SPAN>
3-Jun-2014</SPAN>
(blank)</SPAN>
30-Jul-2014</SPAN>
30-Jul-2014</SPAN>
(blank)</SPAN>
(blank)</SPAN>
11-Jun-2014</SPAN>
(blank)</SPAN>
(blank)</SPAN>
(blank)</SPAN>
25-Jul-2014</SPAN>
(blank)</SPAN>
19-Jun-2014</SPAN>
19-Jun-2014</SPAN>
19-Jun-2014</SPAN>
19-Jun-2014</SPAN>
14-Jul-2014</SPAN>
(blank)</SPAN>
(blank)</SPAN>
(blank)</SPAN>

<TBODY>
</TBODY>

<TBODY>
</TBODY>
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try this, you will have to change the cell references to reflect your spreadsheet.
It's an array formula, so make sure you confirm with control shift enter.


Code:
=IF(SUMPRODUCT((A2:A24=A27)*(C2:C24<>""))<>COUNTIF(A2:A24,A27),"",MAX(IF(A2:A24=A27,C2:C24)))


Excel 2010
ABC
1Parent IDRecord IDApproved On
219958120533231-Jul-14
320199920695128-May-14
42019992069593-Jun-14
52019992075563-Jun-14
6202496213546
720274121278530-Jul-14
820274121278830-Jul-14
9204232213022
10204599209578
1120459920982611-Jun-14
12206745216579
13206745216590
14206994211467
1520721921304125-Jul-14
16207219213046
1720926421458419-Jun-14
1820926421459119-Jun-14
1920926421459519-Jun-14
2020926421459719-Jun-14
2120926421460814-Jul-14
22209264214614
23209264214615
24209264214617
25
26Lookup Parent ID
27201999
283-Jun-14
Sheet1
Cell Formulas
RangeFormula
A28{=IF(SUMPRODUCT((A2:A24=A27)*(C2:C24<>""))<>COUNTIF(A2:A24,A27),"",MAX(IF(A2:A24=A27,C2:C24)))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
Bruce, first thanks for the response. I tried it and it didn't work. It returns the Max Date. I need it to return nothing (e.g., null or blank "") if anyone of the date cells are (blank). What I'm trying to do is say that a Parent record is considered closed IF ALL of the associated Child records (Field name 'Record ID') contain an Approved date. In this instance, the Max Date = Closed Date. However, if any one of the associated Child Records doesn't contain an approved on date, then the Parent Record is still to be considered Open and therefore, has no Max Closed Date.

I'll keep playing with your formula to see if I can get it to work. Try Record # 209264 in Col A to test your formula. It should return null or blank.

Thanks again for all your help! :cool:
 
Upvote 0
Try Record # 209264 in Col A to test your formula. It should return null or blank.

Yeah I did that before I posted it the first time. I tested it extensively and it works fine. I took your data and pasted it into a spreadsheet and worked from there. Copy my data and paste it into the exact cells represented, put in the formula, hit Control Shift Enter and type in what you like, you will see it works.

Here is another screen shot. I simply typed in 209264 and as you can see it returns a blank cell.
You need to make sure that you are referencing the right cells in your data or paste a screen shot that like my data shows exactly what cells you data is in and I will do it for you.

Excel 2010
ABC
1Parent IDRecord IDApproved On
219958120533231-Jul-14
320199920695128-May-14
42019992069593-Jun-14
52019992075563-Jun-14
6202496213546
720274121278530-Jul-14
820274121278830-Jul-14
9204232213022
10204599209578
1120459920982611-Jun-14
12206745216579
13206745216590
14206994211467
1520721921304125-Jul-14
16207219213046
1720926421458419-Jun-14
1820926421459119-Jun-14
1920926421459519-Jun-14
2020926421459719-Jun-14
2120926421460814-Jul-14
22209264214614
23209264214615
24209264214617
25
26Lookup Parent ID
27209264
28

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
119

Array Formulas
CellFormula
A28{=IF(SUMPRODUCT((A2:A24=A27)*(C2:C24<>""))<>COUNTIF(A2:A24,A27),"",MAX(IF(A2:A24=A27,C2:C24)))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
My bad Bruce! I had some junk in the null cells that was causing the problem. I was originally applying the formula directly against the pivot table, and then decided to copy/paste it out into another worksheet to test my suspicion. As soon as I cleaned the cells, everything fell into place. wow. Sorry about that, again my apologies. Again, thanks for all your help! :LOL:
 
Upvote 0
My bad Bruce! I had some junk in the null cells that was causing the problem. I was originally applying the formula directly against the pivot table, and then decided to copy/paste it out into another worksheet to test my suspicion. As soon as I cleaned the cells, everything fell into place. wow. Sorry about that, again my apologies. Again, thanks for all your help! :LOL:

No worries, it was a good experience for me and I'm sure it's not the best solution but it's what I came up with.
I'm here to learn.

Good Luck! (y)
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,298
Members
449,077
Latest member
Rkmenon

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