Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Sumproduct counting blank cells, dates, capturing last row

Please assist.

There are several things I am trying to accomplish.

1) I am trying to count the blanks in several columns for each sheet.
2) I would like to count all the dates in a column.
3) I have a function that gives me the last row for every sheet. However I
would like to get the last row number to use in the sumproduct cell
reference.
for ex. sumproduct(j24:lastrow)


I tried the below to count the blanks in 2 columns.
What have I done wrong?


wsNew.Range("f7").Value =
Evaluate("=sumproduct((F25:f136=ax3)*(j24:j136="") )") +
sumproduct((F24:f2650=ax1)*(k24:k2650=""))")

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Sumproduct counting blank cells, dates, capturing last row

Hi Gwen,

In answer to your questions:
1) I am trying to count the blanks in several columns for each sheet.

The following works for one column and therefore call repeatedly for each
column.

function BlanksInColumn(c as string) as long
on error resume next
BlanksInColumn = Application.WorksheetFunction.CountBlank _
(ActiveSheet.Columns(c))
end function

2) I would like to count all the dates in a column.

function countdates(c as string)

Function countdates(ByVal c As String)
Dim i As Long
Dim nr As Long
Dim col As Range
On Error GoTo endline
c = c & "1" ' get a cell
Set col = Range(c).EntireColumn
c = 0
For i = 1 To 65536
If IsDate(col.Cells(i, 1)) Then
nr = nr + 1
End If
Next i
countdates = nr
endline:
Set col = Nothing
End Function


3) I have a function that gives me the last row for every sheet. However I
would like to get the last row number to use in the sumproduct cell
reference.
for ex. sumproduct(j24:lastrow)


isn't it the row number from the function you have?


--
Hope this helps
Martin Fishlock


"Gwen" wrote:

Please assist.

There are several things I am trying to accomplish.

1) I am trying to count the blanks in several columns for each sheet.
2) I would like to count all the dates in a column.
3) I have a function that gives me the last row for every sheet. However I
would like to get the last row number to use in the sumproduct cell
reference.
for ex. sumproduct(j24:lastrow)


I tried the below to count the blanks in 2 columns.
What have I done wrong?


wsNew.Range("f7").Value =
Evaluate("=sumproduct((F25:f136=ax3)*(j24:j136="") )") +
sumproduct((F24:f2650=ax1)*(k24:k2650=""))")

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Sumproduct counting blank cells, dates, capturing last row

Thank you for the solutions.
I guess I didn't explain my problem very well.
I have to count blanks and dates based on multiple criteria thats why I
used the sumproduct formula.

For ex. count the blanks for saleswoman a, saleswoman b, etc.
count the dates for saleswoman a, saleswoman b, etc.

"Martin Fishlock" wrote:

Hi Gwen,

In answer to your questions:
1) I am trying to count the blanks in several columns for each sheet.

The following works for one column and therefore call repeatedly for each
column.

function BlanksInColumn(c as string) as long
on error resume next
BlanksInColumn = Application.WorksheetFunction.CountBlank _
(ActiveSheet.Columns(c))
end function

2) I would like to count all the dates in a column.

function countdates(c as string)

Function countdates(ByVal c As String)
Dim i As Long
Dim nr As Long
Dim col As Range
On Error GoTo endline
c = c & "1" ' get a cell
Set col = Range(c).EntireColumn
c = 0
For i = 1 To 65536
If IsDate(col.Cells(i, 1)) Then
nr = nr + 1
End If
Next i
countdates = nr
endline:
Set col = Nothing
End Function


3) I have a function that gives me the last row for every sheet. However I
would like to get the last row number to use in the sumproduct cell
reference.
for ex. sumproduct(j24:lastrow)


isn't it the row number from the function you have?


--
Hope this helps
Martin Fishlock


"Gwen" wrote:

Please assist.

There are several things I am trying to accomplish.

1) I am trying to count the blanks in several columns for each sheet.
2) I would like to count all the dates in a column.
3) I have a function that gives me the last row for every sheet. However I
would like to get the last row number to use in the sumproduct cell
reference.
for ex. sumproduct(j24:lastrow)


I tried the below to count the blanks in 2 columns.
What have I done wrong?


wsNew.Range("f7").Value =
Evaluate("=sumproduct((F25:f136=ax3)*(j24:j136="") )") +
sumproduct((F24:f2650=ax1)*(k24:k2650=""))")

Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
counting dates using SUMPRODUCT Marge Excel Discussion (Misc queries) 4 July 29th 09 02:00 PM
=SUMPRODUCT formula is counting the blank cells as well as zero's JR Excel Worksheet Functions 2 March 16th 06 03:39 PM
=SUMPRODUCT formula is counting the blank cells as well as zero's JR Excel Worksheet Functions 1 March 16th 06 02:46 PM
sumproduct--counting--zero--blank cells jeremy via OfficeKB.com Excel Discussion (Misc queries) 4 August 16th 05 03:22 PM
SUMPRODUCT CAPTURING DATA FROM ANOTHER SPREADSHEET Carole O Excel Worksheet Functions 6 October 27th 04 09:36 PM


All times are GMT +1. The time now is 10:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"