Need A nested If Statement

bhutchinson

New Member
Joined
Jun 10, 2011
Messages
5
Excerpt from a sheet of data is below. I need an if statement that will evaluate several data elements and flag the most recent date when selected criteria are met.
I can then do a simple data sort or pivot table and isolate only the most recent status dates and statuses IF the account # and case # are equal (repeated)

If the account # is repeated in several rows I need it to evaluate the case #, and status date
If the case # is repeated in several rows, I need to evaluate the status date associated with the case and flag the most recent status

There may only be a single account # and case # in some instances.


[TABLE="width: 1107"]
<tbody>[TR]
[TD]Acct # [/TD]
[TD]Status Date [/TD]
[TD]Status [/TD]
[TD]Case # [/TD]
[TD]ID [/TD]
[TD]Criteria [/TD]
[/TR]
[TR]
[TD="align: right"]10111171[/TD]
[TD="align: right"]3/9/2015[/TD]
[TD]2[/TD]
[TD]1414980[/TD]
[TD]13[/TD]
[TD]Most Recent status date for 1011171 for case 1414980 FLAG [/TD]
[/TR]
[TR]
[TD="align: right"]10111171[/TD]
[TD="align: right"]12/3/2014[/TD]
[TD]1[/TD]
[TD]1414980[/TD]
[TD]13[/TD]
[TD]delete[/TD]
[/TR]
[TR]
[TD="align: right"]10111171[/TD]
[TD="align: right"]12/3/2014[/TD]
[TD]6[/TD]
[TD]1414980[/TD]
[TD]13[/TD]
[TD]delete[/TD]
[/TR]
[TR]
[TD="align: right"]10111171[/TD]
[TD="align: right"]8/27/2014[/TD]
[TD]2[/TD]
[TD]1411223[/TD]
[TD]13[/TD]
[TD]Most Recent status date for 1011171 for case 1411223 FLAG [/TD]
[/TR]
[TR]
[TD="align: right"]10111171[/TD]
[TD="align: right"]3/26/2014[/TD]
[TD]1[/TD]
[TD]1411223[/TD]
[TD]13[/TD]
[TD]delete [/TD]
[/TR]
[TR]
[TD="align: right"]10111171[/TD]
[TD="align: right"]3/26/2014[/TD]
[TD]6[/TD]
[TD]1411223[/TD]
[TD]13[/TD]
[TD]delete [/TD]
[/TR]
[TR]
[TD="align: right"]10111327[/TD]
[TD="align: right"]7/2/2014[/TD]
[TD]2[/TD]
[TD]1411574[/TD]
[TD]13[/TD]
[TD]Most recent status date for account # 10111321 for case # 1411574 FLAG [/TD]
[/TR]
[TR]
[TD="align: right"]10111327[/TD]
[TD="align: right"]4/15/2014[/TD]
[TD]1[/TD]
[TD]1411574[/TD]
[TD]13[/TD]
[TD]delete[/TD]
[/TR]
[TR]
[TD="align: right"]10111327[/TD]
[TD="align: right"]4/15/2014[/TD]
[TD]6[/TD]
[TD]1411574[/TD]
[TD]13[/TD]
[TD]delete[/TD]
[/TR]
[TR]
[TD="align: right"]10111327[/TD]
[TD="align: right"]1/9/2008[/TD]
[TD]3[/TD]
[TD]0512996[/TD]
[TD]13[/TD]
[TD]Most recent status date for account 10111327 for case 0512996 FLAG[/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]10/5/2015[/TD]
[TD]2[/TD]
[TD]1456363[/TD]
[TD]13[/TD]
[TD]Most recent status date for account 10113100 for case # 1456363 FLAG [/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]11/13/2014[/TD]
[TD]T[/TD]
[TD]1456363[/TD]
[TD]13[/TD]
[TD]delete [/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]9/8/2014[/TD]
[TD]1[/TD]
[TD]1456363[/TD]
[TD]13[/TD]
[TD]delete [/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]9/8/2014[/TD]
[TD]6[/TD]
[TD]1456363[/TD]
[TD]13[/TD]
[TD]delete [/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]2/11/2014[/TD]
[TD]2[/TD]
[TD]1352578[/TD]
[TD]13[/TD]
[TD]Most recent status date for account 10113100 for case # 1352578 FLAG [/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]12/3/2013[/TD]
[TD]3[/TD]
[TD]1356435[/TD]
[TD]7[/TD]
[TD]Most recent status date for account 10113100 for case # 1356435 FLAG [/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]8/13/2013[/TD]
[TD]6[/TD]
[TD]1356435[/TD]
[TD]7[/TD]
[TD]delete [/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]7/18/2013[/TD]
[TD]T[/TD]
[TD]1352578[/TD]
[TD]13[/TD]
[TD]delete [/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]4/2/2013[/TD]
[TD]1[/TD]
[TD]1352578[/TD]
[TD]13[/TD]
[TD]delete [/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]4/2/2013[/TD]
[TD]6[/TD]
[TD]1352578[/TD]
[TD]13[/TD]
[TD]delete [/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]4/2/2013[/TD]
[TD]9[/TD]
[TD]1352578[/TD]
[TD]13[/TD]
[TD]delete [/TD]
[/TR]
[TR]
[TD="align: right"]10113100[/TD]
[TD="align: right"]7/21/2011[/TD]
[TD]3[/TD]
[TD]0655575[/TD]
[TD]13[/TD]
[TD]Most recent status date for 10113100 for case # 0655575 FLAG [/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col><col></colgroup>[/TABLE]
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Note that this uses an array formula - confirm with ctrl+shift+enter, not just enter.
Excel Workbook
ABCDEF
1Acct #Status DateStatusCase #IDCriteria
2101111713/9/20152141498013Most recent status date for 10111171 for case 1414980 FLAG
31011117112/3/20141141498013
41011117112/3/20146141498013
5101111718/27/20142141122313Most recent status date for 10111171 for case 1411223 FLAG
6101111713/26/20141141122313
7101111713/26/20146141122313
8101113277/2/20142141157413Most recent status date for 10111327 for case 1411574 FLAG
9101113274/15/20141141157413
10101113274/15/20146141157413
11101113271/9/2008351299613Most recent status date for 10111327 for case 512996 FLAG
121011310010/5/20152145636313Most recent status date for 10113100 for case 1456363 FLAG
131011310011/13/2014T145636313
14101131009/8/20141145636313
15101131009/8/20146145636313
16101131002/11/20142135257813Most recent status date for 10113100 for case 1352578 FLAG
171011310012/3/2013313564357Most recent status date for 10113100 for case 1356435 FLAG
18101131008/13/2013613564357
19101131007/18/2013T135257813
20101131004/2/20131135257813
21101131004/2/20136135257813
22101131004/2/20139135257813
23101131007/21/2011365557513Most recent status date for 10113100 for case 655575 FLAG
Sheet2
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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