I have thousands of cells of data formated with the headers of
UID, Date, Mass, Start / End, Float Days, Days from Start
I have a simple version of what the sheet looks like below:
Each new data entry is entered as a row. The data for each UID ( unique ID) is taken on non-consistent days over the length of its float life. (ex: wood floats and I take its mass on different days until it sinks).
I want to Identify a "Float Days" by taking the Sink date and subtracting it by the first reference of the ID.
#simple:
When the row has "1" in the D column, Find the ID on that row, then find that ID when that row has "0".
Take the date from that row and subtract by sink date to give me float days
#complex:
=IF(D16="1", (vlookup(A16 & "0",$A$1:$F$999,2,0)-B16, "")
If possible, I would like to use the framework of the formula to also calculate each data-inputs date in days from its Start Date as shown below:
#simple: in row E
Take the date from current row (row 10 for example), find that ID's start date,
subtract from one another to give me days from time=0
#complex:
=B10-vlookup(A10 & "0",$A$1:$F$999,B,0)
I am confused as to whether I am typing the formula incorrectly or if there is another and easier way to do this. Thank you!
CodePudding user response:
SUMFIS is the better choice here. In cell E2 and copied down:
=IF(D2=1,B2-SUMIFS(B:B,A:A,A2,D:D,0),"")
If you want a same day start/end pair to be equal to 1 instead of 0, just add a 1 to the end of the SUMIFS.