Hi all,
Looking for some input from a Excel guru much smarter than i. I'm wrestling with a SUMPRODUCT formula to count matching entries on multiple criteria. I'm still on Excel 2003 so can't use COUNTIFS etc.
To give you an idea what i'm trying to achieve. I started with this...
=SUMPRODUCT(--('Injury Data_Core'!$X$4:$X$1000=$B$1),--('Injury Data_Core'!$B$4:$B$1000=$B$2),--('Injury Data_Core'!$N$4:$N$1000=$B$3),--('Injury Data_Core'!$K$4:$K$1000=$A39),--('Injury Data_Core'!$F$4:$F$1000=B$38)))
Essentially checking 5 columns of data within a larger 15 column data table for multiple matching criteria. This works fine. B1,B2,B3 are cells containing dynamic criteria that is controlled by front end combo boxes. A39 & B38 are fixed criteria. However, i need alternative scenarios for B2 & B3 where if the combo box = All (not actually a match in the data table). It eliminates that part of the SUMPRODUCT.
I've managed to write the below which when the end user selects All in the 3rd combo box the SUMPRODUCT drops the (,--('Injury Data_Core'!$N$4:$N$1000=$B$3) bit for the TRUE statement. This is working perfect too.
=IF($B$3="All",SUMPRODUCT(--('Injury Data_Core'!$X$4:$X$1000=$B$1),--('Injury Data_Core'!$B$4:$B$1000=$B$2),--('Injury Data_Core'!$K$4:$K$1000=$A39),--('Injury Data_Core'!$F$4:$F$1000=B$38)),SUMPRODUCT(--('Injury Data_Core'!$X$4:$X$1000=$B$1),--('Injury Data_Core'!$B$4:$B$1000=$B$2),--('Injury Data_Core'!$N$4:$N$1000=$B$3),--('Injury Data_Core'!$K$4:$K$1000=$A39),--('Injury Data_Core'!$F$4:$F$1000=B$38)))
However, i can't successfully adapt the above to embed a 2nd IF for when B2 = "All" aswell.
Can someone take a look and assist. Appreciate if can be a bit difficult to visualise without a sample file but would take me a while to remove the sensitive information.
I'm sure there is a more elegant way of writing this and possibly losing the IF statement altogether but i'm a bit stumped so far.
Thanks in advance
Scott
Looking for some input from a Excel guru much smarter than i. I'm wrestling with a SUMPRODUCT formula to count matching entries on multiple criteria. I'm still on Excel 2003 so can't use COUNTIFS etc.
To give you an idea what i'm trying to achieve. I started with this...
=SUMPRODUCT(--('Injury Data_Core'!$X$4:$X$1000=$B$1),--('Injury Data_Core'!$B$4:$B$1000=$B$2),--('Injury Data_Core'!$N$4:$N$1000=$B$3),--('Injury Data_Core'!$K$4:$K$1000=$A39),--('Injury Data_Core'!$F$4:$F$1000=B$38)))
Essentially checking 5 columns of data within a larger 15 column data table for multiple matching criteria. This works fine. B1,B2,B3 are cells containing dynamic criteria that is controlled by front end combo boxes. A39 & B38 are fixed criteria. However, i need alternative scenarios for B2 & B3 where if the combo box = All (not actually a match in the data table). It eliminates that part of the SUMPRODUCT.
I've managed to write the below which when the end user selects All in the 3rd combo box the SUMPRODUCT drops the (,--('Injury Data_Core'!$N$4:$N$1000=$B$3) bit for the TRUE statement. This is working perfect too.
=IF($B$3="All",SUMPRODUCT(--('Injury Data_Core'!$X$4:$X$1000=$B$1),--('Injury Data_Core'!$B$4:$B$1000=$B$2),--('Injury Data_Core'!$K$4:$K$1000=$A39),--('Injury Data_Core'!$F$4:$F$1000=B$38)),SUMPRODUCT(--('Injury Data_Core'!$X$4:$X$1000=$B$1),--('Injury Data_Core'!$B$4:$B$1000=$B$2),--('Injury Data_Core'!$N$4:$N$1000=$B$3),--('Injury Data_Core'!$K$4:$K$1000=$A39),--('Injury Data_Core'!$F$4:$F$1000=B$38)))
However, i can't successfully adapt the above to embed a 2nd IF for when B2 = "All" aswell.
Can someone take a look and assist. Appreciate if can be a bit difficult to visualise without a sample file but would take me a while to remove the sensitive information.
I'm sure there is a more elegant way of writing this and possibly losing the IF statement altogether but i'm a bit stumped so far.
Thanks in advance
Scott