Hi everyone
I have another small problem with trying to count data from my worksheet.
As the data is in two columns, I am using SumProduct rather than countif.
Column A contains individual single text letters.
Column B contains figures as currency to 2 decimal places, which includes £0.00 as results from a Pivot table calculation plus some cells are temporarily left blank awaiting further data.
Some rows are left blank in order to separate the information into categories.
When using this formula:
=SUMPRODUCT(--($A$5:$A$311="M"),--($B$5:$B$311=0))
it produces a total of 12 whereas the correct total should be 11.
The same formula is used with alternatives to the "M" to count data for different categories.
I have traced the problem to rows where there is an "M" in column A but an adjacent blank cell in column B. The rows where there is an "M" in column A and £0.00 in column B are counted correctly and likewise completely blank rows are ignored.
These individual totals have to match up with the overall total of column B, using =COUNTIF($B$5:$B$311,0) which gives the correct total by ignoring the blank cells.
I have found a way round this by using:
=SUMPRODUCT(--($A$5:$A$311="M"),--($B$5:$B$311=0))-SUMPRODUCT(--($A$5:$A$311="M"),--($B$5:$B$311=""))
which gives me the required correct result but seems a cumbersome way of solving this problem.
Can anyone simplify the for me ...Spellbound
Bookmarks