Sumproduct or alternative

stagnut

New Member
Joined
Sep 27, 2007
Messages
24
Hi,
I have been using a sumproduct formula for some years, and although it works fine I was wondering if there was an alternative way of getting the same result.

In C8 copied down =SUMPRODUCT(($A8>=$A$3:$A$4)*1,($B8<=$B$3:$B$4)*1,($C$3:$C$4)) to show how many are in each hour

StartFinishStaff
22:0004:0010
00:0006:0028
21:0022:000
22:0023:0010
23:0000:0010
00:0001:0038
01:0002:0038
02:0003:0038
03:0004:0038
04:0005:0028
05:0006:0028
06:0007:000
07:0008:000

<tbody>
</tbody>
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
51,418
Office Version
365
Platform
Windows
Is there some problem or issue that is causing you to question it and look for other solutions?
SUMPRODUCT formulas are usually some of the more efficient formulas out there, so if it is working the way you want, I would just leave it be.
If the issue is you have huge amounts of data, so the performance might be slow, your best alternative may be to use a database solution, like Access or SQL.
 

stagnut

New Member
Joined
Sep 27, 2007
Messages
24
There isn't any problem as all works well. It was something I cobbled together many years ago to count the number of occurrences in a time period pre and post midnight, and as I was just looking at Sumifs I wondered what the better one would be.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
51,418
Office Version
365
Platform
Windows
From what I have read in the past, I believe that SUMIFS is not any more effiecient than SUMPRODUCT.
So if it is working, there is probably no real incentive to change it.
 

Forum statistics

Threads
1,081,575
Messages
5,359,715
Members
400,545
Latest member
Damntheman30

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top