{"items":["6023c0d7ee3d2e0017a440bb","6023c0d7ee3d2e0017a440ba","6023c0d7ee3d2e0017a440b7"],"styles":{"galleryType":"Columns","groupSize":1,"showArrows":true,"cubeImages":true,"cubeType":"max","cubeRatio":1.7777777777777777,"isVertical":true,"gallerySize":30,"collageAmount":0,"collageDensity":0,"groupTypes":"1","oneRow":false,"imageMargin":5,"galleryMargin":0,"scatter":0,"rotatingScatter":"","chooseBestGroup":true,"smartCrop":false,"hasThumbnails":false,"enableScroll":true,"isGrid":true,"isSlider":false,"isColumns":false,"isSlideshow":false,"cropOnlyFill":false,"fixedColumns":0,"enableInfiniteScroll":true,"isRTL":false,"minItemSize":50,"rotatingGroupTypes":"","rotatingCropRatios":"","columnWidths":"","gallerySliderImageRatio":1.7777777777777777,"numberOfImagesPerRow":3,"numberOfImagesPerCol":1,"groupsPerStrip":0,"borderRadius":0,"boxShadow":0,"gridStyle":0,"mobilePanorama":false,"placeGroupsLtr":true,"viewMode":"preview","thumbnailSpacings":4,"galleryThumbnailsAlignment":"bottom","isMasonry":false,"isAutoSlideshow":false,"slideshowLoop":false,"autoSlideshowInterval":4,"bottomInfoHeight":0,"titlePlacement":["SHOW_ON_THE_RIGHT","SHOW_BELOW"],"galleryTextAlign":"center","scrollSnap":false,"itemClick":"nothing","fullscreen":true,"videoPlay":"hover","scrollAnimation":"NO_EFFECT","slideAnimation":"SCROLL","scrollDirection":0,"scrollDuration":400,"overlayAnimation":"FADE_IN","arrowsPosition":0,"arrowsSize":23,"watermarkOpacity":40,"watermarkSize":40,"useWatermark":true,"watermarkDock":{"top":"auto","left":"auto","right":0,"bottom":0,"transform":"translate3d(0,0,0)"},"loadMoreAmount":"all","defaultShowInfoExpand":1,"allowLinkExpand":true,"expandInfoPosition":0,"allowFullscreenExpand":true,"fullscreenLoop":false,"galleryAlignExpand":"left","addToCartBorderWidth":1,"addToCartButtonText":"","slideshowInfoSize":200,"playButtonForAutoSlideShow":false,"allowSlideshowCounter":false,"hoveringBehaviour":"NEVER_SHOW","thumbnailSize":120,"magicLayoutSeed":1,"imageHoverAnimation":"NO_EFFECT","imagePlacementAnimation":"NO_EFFECT","calculateTextBoxWidthMode":"PERCENT","textBoxHeight":26,"textBoxWidth":200,"textBoxWidthPercent":65,"textImageSpace":10,"textBoxBorderRadius":0,"textBoxBorderWidth":0,"loadMoreButtonText":"","loadMoreButtonBorderWidth":1,"loadMoreButtonBorderRadius":0,"imageInfoType":"ATTACHED_BACKGROUND","itemBorderWidth":0,"itemBorderRadius":0,"itemEnableShadow":false,"itemShadowBlur":20,"itemShadowDirection":135,"itemShadowSize":10,"imageLoadingMode":"BLUR","expandAnimation":"NO_EFFECT","imageQuality":90,"usmToggle":false,"usm_a":0,"usm_r":0,"usm_t":0,"videoSound":false,"videoSpeed":"1","videoLoop":true,"jsonStyleParams":"","gallerySizeType":"px","gallerySizePx":1000,"allowTitle":true,"allowContextMenu":true,"textsHorizontalPadding":-30,"itemBorderColor":{"themeName":"color_12","value":"rgba(200,200,200,0)"},"showVideoPlayButton":true,"galleryLayout":2,"calculateTextBoxHeightMode":"MANUAL","targetItemSize":1000,"selectedLayout":"2|bottom|1|max|true|0|true","layoutsVersion":2,"selectedLayoutV2":2,"isSlideshowFont":true,"externalInfoHeight":26,"externalInfoWidth":0.65},"container":{"width":300,"galleryWidth":305,"galleryHeight":0,"scrollBase":0,"height":null}}

# Create Dynamic Excel Formulas with the OFFSET() Function

Microsoft Excel offers many ways to work with and analyze your data. There are loads of functions to calculate and lookup data, charts to visualize, PivotTables to quickly summarize and much more. These features, and more, combine to make Microsoft Excel a very powerful data analytics tool. Using just one of the tools Excel has to offer is great, but Excel really shines when you start combining multiple features together.

**BUILDING A DYNAMIC SUM FORMULA**

I got an excellent question in my complete Microsoft Excel - Beginner to Advanced course the other day and want to share it with you.

The question asked how you could SUM a dynamic range of cells. There are times when the user wishes to SUM the first 5 cells in a range, other times when the first 7 cells are needed and so on.

In the above graphic, the user may want to SUM the first 5 sales amounts, other times the first 7.

We can do this by creating a SUM formula to include all the cells and then modify the formula to include only the cells need.

**=SUM(C3:C7)**

or

**=SUM(C3:C10)**

This works, but it involves manipulating the formula and isn't very user friendly.

**OFFSET() TO THE RESCUE**

Microsoft Excel includes a function called OFFSET().

**OFFSET( range, rows, columns, [height], [width] )**

*Returns a reference to a range that is a specified number of rows and columns from a cell or range of cells. The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and the number of columns to be returned.*

The typical SUM formula in an Excel worksheet, SUM's up a range of cells. If you want to change the range you will need to go into the formula and adjust the referenced range.

By combining the SUM function with the OFFSET you can create a dynamic range to be SUM'd. This technique of combining functions is called NESTING.

**=SUM( OFFSET(C3,0,0,5))**

In the above example, the OFFSET() function is NESTED inside of the SUM().

Here, we can inform the SUM function to use the OFFSET function to determine which cells to include in the SUM.

**OFFSET(C3, 0, 0, 5)**

The above OFFSET informs the SUM function to start with the C3 cell, move 0 ROWS, move 0 COLUMNS, and to include 5 cells starting at C3 and moving down.

Now if the first 7 cells are needed in the SUM, the OFFSET function can be changed from HEIGHT = 5 to HEIGHT = 7.

**DOWNLOAD THE EXERCISE FILE TO PRACTICE**