DateDif based on criteria

时间:2015-07-28 23:10:13

标签: excel datediff

I have data that look like this:

enter image description here

I'd like, based on ID to get the DateDif in days of Initials and any other reassessments (Annuals and Semiannuals). Column D shows what I'd like to see while column E has notes on which cells the DateDif should work on.

I don't know where to start with this..do I use DateDif or Ifs or? Thank you for reviewing.

2 个答案:

答案 0 :(得分:2)

You can use the INDEX function to retrieve the correct minuend and subtrahend of the subtraction formula.

        DATEDIFF staggered

The formula in D2 is,

AmazonSNS snsClient = ... /* initialise the client */;

Map<String, MessageAttributeValue> notificationAttributes = new HashMap<String, MessageAttributeValue>();
notificationAttributes.put("AWS.SNS.MOBILE.MPNS.Type",
        new MessageAttributeValue()
            .withDataType("String")
            .withStringValue("token")); // or "toast" or "raw", depending on the payload
notificationAttributes.put("AWS.SNS.MOBILE.MPNS.NotificationClass",
        new MessageAttributeValue()
            .withDataType("String")
            .withStringValue("realtime"));

PublishRequest request = new PublishRequest();
request.setMessageAttributes(notificationAttributes);
request.setMessageStructure("json");

request.setTargetArn(... /* topic or endpoint ARN */);
request.setMessage(... /* JSON payload */)

snsClient.publish(request);

Fill down as necessary.

The formula looks to column A for the last occurrence of the word 'Initial' according to the row it is currently on and subtracts the date from that row from the date in the current row.

答案 1 :(得分:1)

Your value for D4 is wrong, it should be 289

Starting in D2

=IF(A2<>A1,"",C2-VLOOKUP(A2,A:C,3,0))

If A <> the value above it then it is nothing otherwise take the value in C and minus the initial value for that ID (Done using VLookup and 0 at the end will give an exact match)