Count totals from one sheet and put on another

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
Hi - I don't have any code for this because i'm not sure where to start. On Workbook1.Sheet1 is a lot of data from column A:O. Workbook2 has sheets with names that correspond to column O on Workbook1.Sheet1. I would like to put the date the procedure is run in column A of each corresponding sheet in Workbook2. I then want to count all the rows in column N that match the sheet name and put that in column B. Column C would count the number of rows with "Cookie" in Column M that also matches the sheet name. Each time the procedure is run, it would put a new entry on the next row. So A5 would have 8/8/2019 and then the counts. When i run it tomorrow A6 will start with 8/9/2019 and the counts. Hope I explained that well enough. Is that doable?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
This is code I came up with and it's working. I need to add the date portion in and add to next row part. Is there a way to say put the count on the sheet named apple? and then any other fruit count on the same named sheet? thanks!
Code:
Dim wb1 As Workbook
Dim ws1 As Worksheet


Set wb1 = Workbooks("Workbook1")
Set ws1 = wb1.Worksheets("Sheet1")




With ws1
    Dim x As Long
    x = Sheet23.Range("A" & Rows.Count).End(xlUp).Row
    If x < 1 Then x = 1
    .Range("A5") = Application.WorksheetFunction.CountIf(Sheet23.Range("N2:N" & x), "Apples")
End With




With Sheet23
  Dim cnt As Integer
  cnt = 0
  For i = 1 To 100
    If Cells(i, 14).Value = "Apples" And Cells(i, 13).Value = "Green" Then
      cnt = cnt + 1
    End If
  Next i
End With


ws1.Range("B5").Value = cnt
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top