Results 1 to 9 of 9

Sum offset from found range

Threaded View

  1. #1
    Registered User
    Join Date
    09-03-2018
    Location
    Holland
    MS-Off Ver
    2010
    Posts
    21

    Sum offset from found range

    Hi!

    I want to sum the values in column E by a found value in column A
    The answer of the sum must be displayed in a cell on another worksheet "NewData"

    So for example:

    Because the search word is "hello" the sum is E2 + E3 + E4 + E8

    sumhello.png

    This sum should be displayed in a cell on the other sheet

    I got to this but it doesn't work. Don; t know how to sum the offsetted values. Perhaps I took a wrong turn with this

    Sub SumFoundOffset()
    
    Dim wsData As Worksheet
    Set wsData = Worksheets("Data")
    
    Dim wsNewData As Worksheet
    Set wsNewData = Worksheets("NewData")
    
    Dim dataLastRow As Long
    Dim i As Long
    dataLastRow = wsData.Cells(Rows.Count, 1).End(xlUp).Row
    
    For i = 1 To dataLastRow
            If wsData.Cells(i, 1).Value = "Houten kozijn" Then
                
               wsNewData.Cells("A1") = WorksheetFunction.Sum wsData.Cells(i, 5).Value
            
            End If
    Next
    
    End Sub
    Hope this is clear enough. There is a sample file attached. Any help would be more than welcome!

    Thanks!



    note: also posted this on a dutch support forum
    Attached Files Attached Files
    Last edited by TheOneWeDreamOf; 03-14-2019 at 09:19 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Search for value in row. if found, copy column formulas into found column range
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2017, 10:42 AM
  2. Search for value in a range and overwrite if found and create new if not found
    By mm671750 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-04-2016, 01:19 PM
  3. [SOLVED] Help! - Copy Range (Sheet1,A10:F50), Paste Range (Sheet 2,A1:F41), Offset Range & Repeat
    By cjtimmer in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-30-2015, 06:27 PM
  4. Dynamic Range using Offset, range not found for Pivot
    By GoneBaja in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-08-2012, 09:19 AM
  5. Choosing offset on condition found in combobox change colour of cell??
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-03-2006, 07:53 PM
  6. Want to offset found value using Index
    By Doug Laidlaw in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-09-2005, 09:10 AM
  7. Problem with Range.Cells.Offset and Range.Cells( row + offset, column)
    By erazmus@actrix.co.nz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2005, 01:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1