Offset

%3CLINGO-SUB%20id%3D%22lingo-sub-1276289%22%20slang%3D%22en-US%22%3EOffset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1276289%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20there%20are%20different%20cells%20containing%20numerical%20data%20how%20do%20I%20get%20the%20data%20from%20the%20latest%205%20cells%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20think%20it's%20offset%20but%20how%20to%20arrange%20this%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20value%20of%20the%20latest%205%20cells%20should%20be%20summed%20up%20in%20one%20cell.%3C%2FP%3E%3CP%3EThe%20cells%20from%20which%20to%20retrieve%20data%20are%20in%20the%20same%20row%20but%20with%20other%20data%20and%20text%20in%20between.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20to%20solve%20this%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1276289%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1276733%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1276733%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F606778%22%20target%3D%22_blank%22%3E%40Jrm92%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESUM-OFFSET%20sounds%20like%20an%20option%20for%20you.%20Do%20you%20have%20a%20sample%20workbook%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1276792%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1276792%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F606778%22%20target%3D%22_blank%22%3E%40Jrm92%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHello%2C%20this%20is%20close%20to%20one%20of%20my%20recent%20Youtube%20post.%20Check%20it%20to%20see%20if%20it%20actually%20answers%20your%20question%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dv4yEpYhgwE4%26amp%3Bt%3D61s%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dv4yEpYhgwE4%26amp%3Bt%3D61s%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1276869%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1276869%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F606778%22%20target%3D%22_blank%22%3E%40Jrm92%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20the%20model%20as%20here%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F181748i04916585588ADF24%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eit%20could%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DSUM(INDEX(2%3A2%2C1%2CAGGREGATE(14%2C6%2C1%2FISNUMBER(2%3A2)*COLUMN(2%3A2)%2C%7B5%2C4%2C3%2C2%2C1%7D)))%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EAGGREGATE%20returns%20positions%20of%20the%20latest%20non-texts%20in%20row%20%232%2C%20INDEX%20takes%20values%20from%20these%20position%20and%20finally%20we%20SUM%20them.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1276882%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1276882%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F428790%22%20target%3D%22_blank%22%3E%40Patrick2788%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%20I%20made%20an%20example%20it%20is%20about%20a%20sportsteam.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20fill%20in%20the%20next%20round%20of%20scores%20the%20yellow%20cell%20should%20calculate%20the%20amount%20of%20goals%20scored%20in%20the%20latest%20five%20matches.%20This%20has%20to%20be%20the%20case%20till%20all%20matches%20are%20played.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1278942%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1278942%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F606778%22%20target%3D%22_blank%22%3E%40Jrm92%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETry%20this.%20I%20presumed%20the%20Goals%20scored%20%3D%20%22Con%22%20column.%26nbsp%3B%20If%20it's%20the%20other%20column%20then%20you%20can%20change%20the%20criteria.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1279166%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1279166%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F428790%22%20target%3D%22_blank%22%3E%40Patrick2788%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlmost%20there%2C%20in%20the%20MATCH%20part%20of%20the%20formula%20there%20is%20MATCH%3A%26nbsp%3B(20%3B6%3A6%3B1)-9%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E20%20is%20the%20Look%20up%20value%2C%26nbsp%3B%20why%20is%20this%20the%20lookup%20value%3F%3C%2FP%3E%3CP%3E6%3A6%20is%20the%20row%3C%2FP%3E%3CP%3E%3B1%20is%20exact%20value%3C%2FP%3E%3CP%3E-9%20%3D%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20explain%20this%20so%20I%20can%20adjust%20it%20in%20my%20own%20file%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1279222%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1279222%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F606778%22%20target%3D%22_blank%22%3E%40Jrm92%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EJust%20in%20case%2C%20that%20is%20adjusting%20of%20previous%20variant%20to%20the%20sample%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DIFERROR(SUM(INDEX(%24G7%3A%24XFD7%2C1%2CAGGREGATE(14%2C6%2C1%2F(%24G%244%3A%24XFD%244%3D%22Con%22)%2FISNUMBER(%24G7%3A%24XFD7)*(COLUMN(%24G%244%3A%24XFD%244)-COLUMN(%24F%244))%2C%7B5%2C4%2C3%2C2%2C1%7D)))%2C%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1279264%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1279264%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F606778%22%20target%3D%22_blank%22%3E%40Jrm92%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20MATCH%20finds%20the%20position%20of%20the%20last%20number.%20I'm%20matching%2020%20so%20MATCH%20doesn't%20return%20the%20position%20before%20the%20last%20number.%26nbsp%3B%20It%20will%20never%20find%20a%2020%20in%20that%20row%20so%20it%20returns%20the%20position%20of%20the%20last%20number.%26nbsp%3B%20The%20-9%20ensures%20the%20array%20starts%20at%20instance%201%20of%20where%20we%20want%20to%20begin%20summing.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1283009%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1283009%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F428790%22%20target%3D%22_blank%22%3E%40Patrick2788%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20can't%20get%20the%20appropriate%20distances%20in%20the%20match%20part%20of%20the%20formula.%3C%2FP%3E%3CP%3EI%20adjusted%20the%20exampke%20can%20you%20take%20a%20look%20at%20it%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1283121%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1283121%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F606778%22%20target%3D%22_blank%22%3E%40Jrm92%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETaking%20the%20opportunity%20to%20play%20with%20new%20functions%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%3E%3D%20LET(%20played%2C%20MAX(%20IF(%20ISNUMBER(scores)%2C%20round%20)%20)%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20idx%2C%202%20*%20(%20played-%7B4%2C3%2C2%2C1%2C0%7D%20)%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20Sco%2C%20INDEX(%20scores%2C%20idx-1%20)%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20SUM(Sco)%20)%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CFONT%3Eand%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%3E%3D%20LET(%20played%2C%20MAX(%20IF(%20ISNUMBER(scores)%2C%20round%20)%20)%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20idx%2C%202%20*%20(%20played-%7B4%2C3%2C2%2C1%2C0%7D%20)%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20Con%2C%20INDEX(%20scores%2C%20idx%20)%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20SUM(Con)%20)%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CFONT%3Eare%20the%20sum%20of%20scores%20for%20and%20against%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1283158%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1283158%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20is%20not%20working%20for%20me.%3C%2FP%3E%3CP%3ECould%20you%20put%20the%20formula%20in%20the%20file%20uploaded%20in%20the%20previous%20comment%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1283943%22%20slang%3D%22en-US%22%3ERe%3A%20Offset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1283943%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F606778%22%20target%3D%22_blank%22%3E%40Jrm92%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20LET%20function%20has%20only%20recently%20been%20released%20on%20the%20insider's%20channel%20for%20beta%20testing.%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3EWithout%20it%2C%20there%20is%20a%20catch%20in%20that%20the%20INDEX%20function%20prevents%20spilling%20so%20the%20formula%20needs%20coercion%20to%20work.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3E%3CFONT%20color%3D%22%2399cc00%22%3Eplayed%3A%3C%2FFONT%3E%20%3D%20MAX(%20IF(%20ISNUMBER(scores)%2C%20round%20)%20)%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3E%3CFONT%20color%3D%22%2399cc00%22%3Eidx%3A%3C%2FFONT%3E%20%3D%202%20*%20(%20played%20-%20%7B4%2C3%2C2%2C1%2C0%7D%20)%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3E%3CFONT%20color%3D%22%2399cc00%22%3ESco%3A%3C%2FFONT%3E%20%3D%20INDEX(%20scores%2C%20idx-1%20)%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3E%3CFONT%20color%3D%22%2399cc00%22%3ECon%3A%3C%2FFONT%3E%20%3D%20INDEX(%20scores%2C%20idx%20)%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3E%3D%20SUM(N(IF(1%2CSco)))%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3E%3D%20SUM(N(IF(1%2CCon)))%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

When there are different cells containing numerical data how do I get the data from the latest 5 cells?

 

I think it's offset but how to arrange this?

 

The value of the latest 5 cells should be summed up in one cell.

The cells from which to retrieve data are in the same row but with other data and text in between.

 

How to solve this? 

12 Replies
Highlighted

@Jrm92 

SUM-OFFSET sounds like an option for you. Do you have a sample workbook?

Highlighted

@Jrm92 

 

Hello, this is close to one of my recent Youtube post. Check it to see if it actually answers your question

 

https://www.youtube.com/watch?v=v4yEpYhgwE4&t=61s

Highlighted

@Jrm92 

For the model as here

image.png

it could be

=SUM(INDEX(2:2,1,AGGREGATE(14,6,1/ISNUMBER(2:2)*COLUMN(2:2),{5,4,3,2,1})))

AGGREGATE returns positions of the latest non-texts in row #2, INDEX takes values from these position and finally we SUM them. 

Highlighted

@Patrick2788 

 

Yes I made an example it is about a sportsteam.

 

When I fill in the next round of scores the yellow cell should calculate the amount of goals scored in the latest five matches. This has to be the case till all matches are played.

 

 

Highlighted

@Jrm92 

Try this. I presumed the Goals scored = "Con" column.  If it's the other column then you can change the criteria. 

Highlighted

@Patrick2788 

 

Almost there, in the MATCH part of the formula there is MATCH: (20;6:6;1)-9

 

20 is the Look up value,  why is this the lookup value?

6:6 is the row

;1 is exact value

-9 =?

 

Can you explain this so I can adjust it in my own file

 

Thanks in advance

 

Highlighted

@Jrm92 

Just in case, that is adjusting of previous variant to the sample

=IFERROR(SUM(INDEX($G7:$XFD7,1,AGGREGATE(14,6,1/($G$4:$XFD$4="Con")/ISNUMBER($G7:$XFD7)*(COLUMN($G$4:$XFD$4)-COLUMN($F$4)),{5,4,3,2,1}))),"")
Highlighted

@Jrm92 

The MATCH finds the position of the last number. I'm matching 20 so MATCH doesn't return the position before the last number.  It will never find a 20 in that row so it returns the position of the last number.  The -9 ensures the array starts at instance 1 of where we want to begin summing. 

Highlighted

@Patrick2788 

 

I can't get the appropriate distances in the match part of the formula.

I adjusted the exampke can you take a look at it?

 

 

Highlighted

@Jrm92 

Taking the opportunity to play with new functions

= LET( played, MAX( IF( ISNUMBER(scores), round ) ),
    idx, 2 * ( played-{4,3,2,1,0} ),
    Sco, INDEX( scores, idx-1 ),
    SUM(Sco) )

and

= LET( played, MAX( IF( ISNUMBER(scores), round ) ),
    idx, 2 * ( played-{4,3,2,1,0} ),
    Con, INDEX( scores, idx ),
    SUM(Con) )

are the sum of scores for and against

@Peter Bartholomew 

 

It is not working for me.

Could you put the formula in the file uploaded in the previous comment?

 

Thanks

Highlighted

@Jrm92 

The LET function has only recently been released on the insider's channel for beta testing.  Without it, there is a catch in that the INDEX function prevents spilling so the formula needs coercion to work.

 

played: = MAX( IF( ISNUMBER(scores), round ) )

idx: = 2 * ( played - {4,3,2,1,0} )

Sco: = INDEX( scores, idx-1 )

Con: = INDEX( scores, idx )

= SUM(N(IF(1,Sco)))

= SUM(N(IF(1,Con)))