excel - Dynamic insert function -
it requirement use excel solve issue.
in col a have 0s , 1s various quantities of 0s between 1s. every time 1 appears want difference between 2 numbers given in 2 columns next binary column. wish results calculation stated next previous 1.
i'd cope different software, how achieve excel?
=if(a4=1,offset(b4,match(1,a5:a$1000,0),0)-offset(c4,match(1,a5:a$1000,0),),"")
in d4 , copied down suit seems work.
edit:
=(if(a$=1, ,"") in: if(logical_test,value_if_true,value_if_false) value if false (blank), expressed "".
the value_if_true difference between columnb , columnc values, each ‘located’ offset function in =offset(reference,rows,cols,height,width).
references appropriate column row formula inserted (ie b4 , c4) values required ‘south’ variable amount.
match, in =match(lookup_value, lookup_array, [match_type]) determine extent of offset on case-by-case basis. in reverse order, parameters here match_type = 0 (to require exact match) , lookup_array of columna required. chosen row1000 (by a$1000) can extended far necessary, subject row limit relevant excel version.
the first parameter lookup_value) of course 1 since flag rows contain values subtracted.
without $ between a , 5 in match functions size of array automatically decreases (top cell row reference increases) formula copied down, hence finds next instance (rather same 1 on , on again).
Comments
Post a Comment