Need help in calculation

jawadbintahir's picture

Dear All,
I am facing a problem. (sheet attached).

In given sheet, you can see the column of start, end and day. I need the difference of(B2 and C4) and answer will come on E4. as the day changes difference like (B8 and C12)changes, in this scenario. please advise any thing useful to sort attach sheet.

e.g.jpg
AttachmentSize
100172-56.xlsx111.05 KB

Solution

=IF(COUNTIF(A$2:A3,A3)
C2-OFFSET(C2,-COUNTIF(A$2:A2,A2)+1,-1),"")

Not sure if my last submission worked.

"=IF(COUNTIF(A$2:A3,A3)

Re: Need help in calculation

Paste this into cell A2, and copy it down.

=IF(COUNTIF(A$2:A3,A3)Let me know if this solves your problem! :-)

jawadbintahir's picture

Thank you

i couldn't try this but thanks for help.. :)

It wont let me paste a simple formula in. ffs JOKE

<code>

=IF(COUNTIF(A$2:A3,A3)

<COUNTIF(A$2:A2,A2),

C2-OFFSET(C2,-COUNTIF(A$2:A2,A2)+1,-1),"")

</code>

This will work as you require, no pivot. Just paste into E2 and copy down.

Nick's picture

create a pivot table with row

create a pivot table with row field PuDate, data fields Min of Start, and Max of End
... then you can simply subtract the data

jawadbintahir's picture

Problem Solved

Thank you so much Nick..!! it's really worked