Formula Help with Excel

%3CLINGO-SUB%20id%3D%22lingo-sub-1714474%22%20slang%3D%22en-US%22%3EFormula%20Help%20with%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1714474%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EMy%20spreadsheet%20has%20chronological%20info%20on%20rows%201-63%20then%20starting%20on%20rows%2066%20and%20down%20is%20the%20same%20info%20but%20by%20agent.%20So%20I%20am%20running%20a%20sum%20up%20top%20with%20chronological%20data%20using%20%3DSUM(INDIRECT(%22E3%3AE%22%26amp%3BROW()-1))%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ebut%20when%20I%20use%20that%20formula%20say%20on%20rows%2069-75%20for%20a%20particular%20agent%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3DSUM(INDIRECT(%22F69%3AF%22%26amp%3BROW()-1))%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ea%3C%2FSPAN%3E%3CSPAN%3End%20I%20insert%20more%20rows%20up%20in%20the%20chronological%20section%201-63%20to%20include%20say%20rows%2064%20and%2065%20now.%20It%20keeps%20throwing%20off%20all%20my%20formulas%20on%20the%20bottom%20half%20of%20the%20spreadsheet%20by%202%20rows.%20Please%20help%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1714474%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1714582%22%20slang%3D%22en-US%22%3ERe%3A%20Formula%20Help%20with%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1714582%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F809582%22%20target%3D%22_blank%22%3E%40bethmsu96%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20could%20use%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DSUM(E69%3AOFFSET(E76%2C-1%2C0))%3C%2FP%3E%0A%3CP%3Eand%3C%2FP%3E%0A%3CP%3E%3DSUM(F69%3AOFFSET(F76%2C-1%2C0))%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1714583%22%20slang%3D%22en-US%22%3ERe%3A%20Formula%20Help%20with%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1714583%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F809582%22%20target%3D%22_blank%22%3E%40bethmsu96%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt's%20better%20to%20use%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DSUM(E3%3AINDEX(E%3AE%2CROW()-1))%0Aand%0A%3DSUM(E69%3AINDEX(E%3AE%2CROW()-1))%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWith%20inserted%20row%20formula%20will%20be%20adjusted%20automatically%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

My spreadsheet has chronological info on rows 1-63 then starting on rows 66 and down is the same info but by agent. So I am running a sum up top with chronological data using =SUM(INDIRECT("E3:E"&ROW()-1))

but when I use that formula say on rows 69-75 for a particular agent

=SUM(INDIRECT("F69:F"&ROW()-1))

and I insert more rows up in the chronological section 1-63 to include say rows 64 and 65 now. It keeps throwing off all my formulas on the bottom half of the spreadsheet by 2 rows. Please help

4 Replies
Highlighted

@bethmsu96 

You could use

 

=SUM(E69:OFFSET(E76,-1,0))

and

=SUM(F69:OFFSET(F76,-1,0))

@bethmsu96 

It's better to use

=SUM(E3:INDEX(E:E,ROW()-1))
and
=SUM(E69:INDEX(E:E,ROW()-1))

With inserted row formula will be adjusted automatically

Highlighted

@Sergei Baklan 

I used this formula and it worked great, thank you so much!!!!

=SUM(E69:INDEX(E:E,ROW()-1))

 

What was the difference between your formula with the INDEX and my formula with the INDIRECTor even OFFSET

=SUM(INDIRECT("E69:E"&ROW()-1))

 

Someone else even suggested =SUM(F69:OFFSET(F76,-1,0))

Highlighted

@bethmsu96 

Both OFFSET and INDEX as well as some other functions in Excel return reference, thus work exactly the same way. For example, you may use

=IF(ISTEXT(A1),A2,A1):A10

which returns A2:A10 if value in A1 is text and A1:A10 otherwise.

 

The difference between OFFSET and INDEX is in behaviour - OFFSET is so called Volatile function which is recalculating on every change in worksheet. Other functions are recalculating if only dependant cells are changed. Thus on relatively big workbooks volatile functions could affect performance and better to avoid them. However, it depends. If you are more comfortable with OFFSET and workbook is relatively small - use it rather than save few milliseconds on recalculations. Better to save your own time.

 

INDIRECT takes hardcoded texts and convert it to reference. It's also volatile function (thus performance) and text used as an argument will be kept unchanged with adding/removing rows or any other changes in structure. Of course, you may generate the text based on some conditions which complicates the logic, but what for? Use INDIRECT if only no other options exist.