SOLVED

Problem with SUMPRODUCT(SUBTOTAL(3,OFFSET) Formula

%3CLINGO-SUB%20id%3D%22lingo-sub-1565967%22%20slang%3D%22en-US%22%3EProblem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1565967%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20everyone%2C%3C%2FP%3E%3CP%3EI%20am%20analyzing%20a%20lot%20of%20Likert-scale%20data%20in%20excel.%20One%20tab%20(labeled%20%22Raw%20Data%22)%20is%20where%20the%20data%20is%20input%20and%20can%20be%20filtered.%20Another%20tab%20(labeled%20%22Likert%20Analysis%22)%20is%20where%20I%20have%20formulas%20for%20analyzing%20the%20data%20on%20the%20Raw%20Data%20tab.%20I%20am%20attempting%20to%20use%20the%20formula%20below%20to%20count%20the%20number%20of%20%225s%22%20in%20the%20Raw%20Data%20tab's%20data%20set%20for%20the%20filtered%20data%20only%20(so%2C%20sort%20of%20like%20a%20COUNTIF%20for%20visible%20data)%3A%3C%2FP%3E%3CP%3E%3DSUMPRODUCT(SUBTOTAL(3%2COFFSET('Raw%20Data'!F2%3AF150%2CROW('Raw%20Data'!F2%3AF150)-ROW('Raw%20Data'!F2%3AF150)%2C0))%2C'Raw%20Data'!F2%3AF150%3D5)%2B0%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20far%2C%20I%20only%20get%20a%20%220%22%20in%20the%20cell%20with%20this%20formula.%20I%20attempted%20to%20modify%20the%20formula%20to%20work%20for%20a%20data%20set%20that%20is%20on%20another%20sheet%20than%20the%20one%20where%20this%20formula%20is%20being%20input%2C%20and%20I%20may%20have%20done%20something%20wrong.%20Any%20suggestions%20on%20how%20to%20correctly%20type%20the%20formula%20or%20why%20I%20am%20only%20returning%20a%20%220%22%20from%20the%20formula%3F%3C%2FP%3E%3CP%3EThank%20you!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1565967%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1566070%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1566070%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F749456%22%20target%3D%22_blank%22%3E%40dev1050%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'm%20not%20sure%20what%20you'd%20like%20to%20calculate.%20SUBTOTAL(3%2COFFSET%20returns%20an%20array%20of%20149%20elements%20size%20each%20of%20which%20is%20equal%20to%20number%20of%20not%20empty%20cells%20in%20F2%3AF150.%20Next%20part%20returns%20149%20TRUE%20or%20FALSE%20which%20SUMPRODUCT%20is%20ignored%2C%20as%20well%20as%20texts%2C%20thus%20result%20always%20will%20be%20zero.%20You%20shall%20convert%20second%20part%20to%20numbers%20as%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DSUMPRODUCT(%0ASUBTOTAL(3%2COFFSET('Raw%20Data'!F2%3AF150%2CROW('Raw%20Data'!F2%3AF150)-ROW('Raw%20Data'!F2%3AF150)%2C0))%2C%0A('Raw%20Data'!F2%3AF150%3D5)%2B0)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Ewhen%20sometimes%20it'll%20be%20non-zero%20result.%26nbsp%3B%20Other%20words%2C%20move%20%2B0%20to%20the%20second%20part%20of%20SUMPRODUCT.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1566080%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1566080%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F749456%22%20target%3D%22_blank%22%3E%40dev1050%3C%2FA%3E%26nbsp%3B%20I'm%20not%20sure%20where%20you%20got%20that%20formula%20and%20why%20you%20are%20using%20it%20instead%20of%20a%20COUNTIF().%26nbsp%3B%20I%20also%20assume%20by%20%225s%22%20you%20really%20mean%20%225%22s%20(i.e.%20the%20number%205%20not%20the%20text%20'5s').%26nbsp%3B%20I'm%20also%20going%20to%20guess%20the%20original%20formula%20you%20found%20had%20some%20'%24'%20in%20the%20cell%20range%20references.%26nbsp%3B%20Just%20curious%20why%20this%20doesn't%20work%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DCOUNTIF('Raw%20Data'!%24F%242%3A%24F%24150%2C5)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBTW%2C%20I%20don't%20know%20what%20is%20special%20about%20'5'%20if%20anything%20but%20you%20might%20want%20to%20set%20a%20place%20in%20your%20workbook%20for%20constants%20like%20that%20and%20refer%20to%20it.%26nbsp%3B%20If%20it%20is%20a%20constant%20maybe%20define%20it%20in%20the%20Name%20Manager.%26nbsp%3B%20If%20it%20is%20something%20you%20will%20change%20often%20put%20it%20on%20the%20sheet%20(e.g.%20N1%3D%22This%20constant%20...%22%20and%20then%20M1%3D5%20and%20then%20put%20%24M%241%20in%20your%20formula).%26nbsp%3B%20Or%20better%20yet%20do%20both%20and%20in%20Name%20Manager%20define%20%22Const_Name%22%20%3D%26gt%3B%20%24M%241%20and%20then%20use%20that%20Name%20in%20the%20formula(s).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEDIT%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%20would%20you%20agree%20the%20original%20formula%20'corrected'%20in%20the%20way%20you%20did%2C%20could%20be%20equally%20written%20as%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DCOUNTIF('Raw%20Data'!%24F%242%3A%24F%24150%2C5)*COUNTA('Raw%20Data'!%24F%242%3A%24F%24150)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1566114%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1566114%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20simply%20don't%20understand%20what%20we%20calculate%20here%2C%20thus%20can't%20agree%20or%20disagree.%20The%20obvious%20thing%20was%20to%20convert%20logical%20values%20to%20numbers.%20With%20that%20entire%20formula%20always%20returns%20COUNTA%20in%20F2%3AF150%20or%20zero%2C%20depends%20on%20magic%205%20is%20less%20than%20size%20of%20the%20range%20or%20not.%20Most%20probably%20not%20what%20expected.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20have%20no%20idea%20what%20is%20%22%3CSPAN%3ELikert-scale%20data%22%20and%20what%20we%20shall%20to%20calculate%20for%20the%20analysis.%20Perhaps%20you%20are%20right.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1566332%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1566332%22%20slang%3D%22en-US%22%3EThe%20formula%20can%20be%20fixed%20to%20not%20return%20an%20error%2C%20but%20it's%20hard%20to%20say%20if%20that%20is%20what%20you%20want%20as%20you've%20not%20stated%20what%20you're%20trying%20to%20calculate.%20As%20it%20stands%2C%20it%20appears%20the%20formula%20will%20count%20the%20number%20of%205's%20in%20Column%20F%20and%20multiply%20that%20count%20by%20the%20number%20of%20visible%20rows%20in%20the%20filtered%20range%2C%20which%20seems%20odd.%3CBR%20%2F%3E%3CBR%20%2F%3EBy%20chance%2C%20are%20you%20trying%20to%20count%20the%20number%20of%205's%20in%20Column%20F%20that%20are%20visible%20(perhaps%20some%20are%20invisible%20due%20to%20filters%20applied%20to%20other%20columns)%3F%20If%20so%2C%20then%20I%20think%20this%20is%20what%20you%20want%20(hit%20Ctrl%2BShift%2BEnter%20after%20copying%2Ftyping%20into%20the%20formula%20bar)%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3DSUMPRODUCT(--('Raw%20Data'!%24F%242%3A%24F%24150%3D5)%2CSUBTOTAL(3%2COFFSET('Raw%20Data'!%24F%242%2CROW('Raw%20Data'!%24F%242%3A%24F%24150)-ROW('Raw%20Data'!%24F%242)%2C0%2C1%2C1)))%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1568840%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1568840%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3Band%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20responses.%20You%20are%20correct%20in%20stating%20that%20I%20am%20searching%20for%20the%20number%205%20in%20a%20given%20list%20where%20the%20range%20is%201%20through%205%20or%20blank%20(if%20the%20respondent%20did%20not%20answer).%20As%20far%20as%20using%20a%20COUNTIF%2C%20I%20receive%20all%20counts%20of%20cells%20with%20a%205%2C%20even%20when%20the%20list%20is%20filtered%20(e.g.%2C%20by%20program%20name).%3C%2FP%3E%3CP%3EThe%20Raw%20Data%20tab%20is%20set%20up%20with%20the%20following%20columns%20from%20left%20to%20right%3A%20Program%20Name%2C%20Location%2C%20Region%2C%20Date%2C%20Respondent%20number%20(ID)%2C%20Q1%2C%20Q2%2C%20Q3%2C%20Q4%2C%20Q5.%20Columns%20F-J%20are%20Q1-Q5%20(Question%201%2C%20Questions%202%2C%20etc.)%20The%20rows%20are%20individual%20respondents.%20So%2C%20each%20cell%20beneath%20Q1-Q5%20will%20be%20populated%20with%20either%20a%201%2C%202%2C%203%2C%204%2C%20or%205%20depending%20on%20the%20respondents%20answer%20(or%20left%20blank%20if%20the%20respondent%20didn't%20answer).%20These%20values%20are%20in%20accordance%20to%20a%20Likert%20scale%20(1-strongly%20disagree%2C%202-disagree%2C%203-neutral%2C%204-agree%2C%205-strongly%20agree)%20given%20these%20are%20the%20results%20of%20a%20survey.%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20reason%20for%20attempting%20the%20formula%20provided%20was%20to%20be%20able%20to%20have%20the%20formula%20return%20only%20what%20data%20is%20currently%20visible%20is%20I%20filter%20the%20data%20based%20of%20program%20name%2C%20region%2C%20etc.%20However%2C%20COUNTIF%20does%20not%20take%20filtering%20into%20account.%20After%20some%20research%2C%20I%20found%20this%20site%20%3CA%20href%3D%22https%3A%2F%2Fwww.extendoffice.com%2Fdocuments%2Fexcel%2F2519-excel-countif-filtered-data.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.extendoffice.com%2Fdocuments%2Fexcel%2F2519-excel-countif-filtered-data.html%3C%2FA%3E%26nbsp%3Bexplaining%20how%20to%20use%20SUMPRODUCT%20to%20get%20the%20information%20I%20want.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hope%20this%20helps!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1568882%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1568882%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675152%22%20target%3D%22_blank%22%3E%40JMB17%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20apologize%20for%20not%20attempting%20your%20formula%20prior%20to%20my%20previous%20reply%20but%20YES!%20This%20is%20%3CU%3EEXACTLY%3C%2FU%3E%20what%20I%20was%20needing!!%20THANK%20YOU!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1568938%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1568938%22%20slang%3D%22en-US%22%3ENo%20worries.%20I'm%20glad%20that%20worked%20for%20you.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1568970%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1568970%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675152%22%20target%3D%22_blank%22%3E%40JMB17%3C%2FA%3E%2C%3C%2FP%3E%3CP%3EIn%20attempts%20to%20understand%20the%20formula%20more%2C%20could%20I%20ask%20for%20an%20explanation%20of%20the%20formula's%20parts%3F%20I%20am%20hoping%20I%20can%20understand%20it%20and%20manipulate%20it%20for%20other%20needs%20(e.g.%2C%20I%20need%20to%20know%20the%20total%20number%20of%20surveys.%20So%2C%20I%20hope%20I%20can%20I%20change%20it%20to%20just%20return%20cells%20that%20have%20anything%20in%20them%20from%20the%20filtered%20data%20on%20column%20E%20%5BRespondent%20ID%5D).%20I%20figured%20out%20how%20to%20manipulate%20the%20formula%20to%20collect%20the%20number%20of%20responses%20containing%204%2C%203%2C%202%2C%20and%201!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1569003%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1569003%22%20slang%3D%22en-US%22%3EIf%20you%20just%20need%20the%20total%20number%20of%20items%20in%20the%20filtered%20range%2C%20then%20I%20think%3CBR%20%2F%3E%3CBR%20%2F%3E%3DSUBTOTAL(3%2C'Raw%20Data'!%24F%242%3A%24F%24150)%3CBR%20%2F%3E%3CBR%20%2F%3Eshould%20do%20the%20trick.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1569019%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1569019%22%20slang%3D%22en-US%22%3EI%20can%20try%20to%20explain%20better%20how%20the%20formula%20works%2C%20but%20it%20probably%20won't%20be%20until%20later%20this%20evening.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1569021%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1569021%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675152%22%20target%3D%22_blank%22%3E%40JMB17%3C%2FA%3E%26nbsp%3B!!%20This%20did%20work!%20Thank%20you!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1569654%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1569654%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F749456%22%20target%3D%22_blank%22%3E%40dev1050%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20attached%20a%20file%20to%20try%20to%20illustrate%20how%20the%20formula%20is%20working.%20There%20is%20a%20tab%20with%20comments%20regarding%20how%20the%20functions%20are%20being%20used%20and%20also%20a%20tab%20with%20an%20example%20table%20that%20hopefully%20provides%20some%20useful%20illustration.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20here%20is%20a%20link%20to%20a%20site%20that%20includes%20additional%20explanation%20regarding%20the%20use%20of%20sumproduct%20in%20multiple%20condition%20tests%20that%20might%20also%20be%20helpful.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fxldynamic.com%2Fsource%2Fxld.SUMPRODUCT.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fxldynamic.com%2Fsource%2Fxld.SUMPRODUCT.html%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1570637%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1570637%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675152%22%20target%3D%22_blank%22%3E%40JMB17%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20so%20much!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1570892%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20SUMPRODUCT(SUBTOTAL(3%2COFFSET)%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1570892%22%20slang%3D%22en-US%22%3EYou're%20quite%20welcome!%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hi everyone,

I am analyzing a lot of Likert-scale data in excel. One tab (labeled "Raw Data") is where the data is input and can be filtered. Another tab (labeled "Likert Analysis") is where I have formulas for analyzing the data on the Raw Data tab. I am attempting to use the formula below to count the number of "5s" in the Raw Data tab's data set for the filtered data only (so, sort of like a COUNTIF for visible data):

=SUMPRODUCT(SUBTOTAL(3,OFFSET('Raw Data'!F2:F150,ROW('Raw Data'!F2:F150)-ROW('Raw Data'!F2:F150),0)),'Raw Data'!F2:F150=5)+0

 

So far, I only get a "0" in the cell with this formula. I attempted to modify the formula to work for a data set that is on another sheet than the one where this formula is being input, and I may have done something wrong. Any suggestions on how to correctly type the formula or why I am only returning a "0" from the formula?

Thank you!!

14 Replies
Highlighted

@dev1050 

I'm not sure what you'd like to calculate. SUBTOTAL(3,OFFSET returns an array of 149 elements size each of which is equal to number of not empty cells in F2:F150. Next part returns 149 TRUE or FALSE which SUMPRODUCT is ignored, as well as texts, thus result always will be zero. You shall convert second part to numbers as

=SUMPRODUCT(
SUBTOTAL(3,OFFSET('Raw Data'!F2:F150,ROW('Raw Data'!F2:F150)-ROW('Raw Data'!F2:F150),0)),
('Raw Data'!F2:F150=5)+0)

when sometimes it'll be non-zero result.  Other words, move +0 to the second part of SUMPRODUCT.

Highlighted

@dev1050  I'm not sure where you got that formula and why you are using it instead of a COUNTIF().  I also assume by "5s" you really mean "5"s (i.e. the number 5 not the text '5s').  I'm also going to guess the original formula you found had some '$' in the cell range references.  Just curious why this doesn't work:

 

=COUNTIF('Raw Data'!$F$2:$F$150,5)

 

BTW, I don't know what is special about '5' if anything but you might want to set a place in your workbook for constants like that and refer to it.  If it is a constant maybe define it in the Name Manager.  If it is something you will change often put it on the sheet (e.g. N1="This constant ..." and then M1=5 and then put $M$1 in your formula).  Or better yet do both and in Name Manager define "Const_Name" => $M$1 and then use that Name in the formula(s).

 

EDIT: @Sergei Baklan  would you agree the original formula 'corrected' in the way you did, could be equally written as:

 

=COUNTIF('Raw Data'!$F$2:$F$150,5)*COUNTA('Raw Data'!$F$2:$F$150)

 

 

 

Highlighted

@mtarler 

I simply don't understand what we calculate here, thus can't agree or disagree. The obvious thing was to convert logical values to numbers. With that entire formula always returns COUNTA in F2:F150 or zero, depends on magic 5 is less than size of the range or not. Most probably not what expected.

 

I have no idea what is "Likert-scale data" and what we shall to calculate for the analysis. Perhaps you are right.

 

Highlighted
Best Response confirmed by dev1050 (Occasional Contributor)
Solution
The formula can be fixed to not return an error, but it's hard to say if that is what you want as you've not stated what you're trying to calculate. As it stands, it appears the formula will count the number of 5's in Column F and multiply that count by the number of visible rows in the filtered range, which seems odd.

By chance, are you trying to count the number of 5's in Column F that are visible (perhaps some are invisible due to filters applied to other columns)? If so, then I think this is what you want (hit Ctrl+Shift+Enter after copying/typing into the formula bar):

=SUMPRODUCT(--('Raw Data'!$F$2:$F$150=5),SUBTOTAL(3,OFFSET('Raw Data'!$F$2,ROW('Raw Data'!$F$2:$F$150)-ROW('Raw Data'!$F$2),0,1,1)))
Highlighted

Hi @mtarler@Sergei Baklan, and @JMB17 , 

Thank you for your responses. You are correct in stating that I am searching for the number 5 in a given list where the range is 1 through 5 or blank (if the respondent did not answer). As far as using a COUNTIF, I receive all counts of cells with a 5, even when the list is filtered (e.g., by program name).

The Raw Data tab is set up with the following columns from left to right: Program Name, Location, Region, Date, Respondent number (ID), Q1, Q2, Q3, Q4, Q5. Columns F-J are Q1-Q5 (Question 1, Questions 2, etc.) The rows are individual respondents. So, each cell beneath Q1-Q5 will be populated with either a 1, 2, 3, 4, or 5 depending on the respondents answer (or left blank if the respondent didn't answer). These values are in accordance to a Likert scale (1-strongly disagree, 2-disagree, 3-neutral, 4-agree, 5-strongly agree) given these are the results of a survey. 

My goal is to see how many respondents answered "5" for Q1. I will also do this for how many 4s, 3s, 2s, and 1s in order to calculate statistics on responses (i.e., I can see that there 45 respondents who put "5" for Q1, 52 respondents put a "4" for Q1, and 48 respondents put a "5" for Q2). I attached a picture of what I am referring to. My reason for attempting the formula provided was to be able to have the formula return only what data is currently visible as I filter the data based of program name, region, etc. Currently, the COUNTIF formula returns all that is in the Raw Data sheet, regardless of filtering because is counts all cells with the value, even if "hidden" or "not visible". After some research, I found this site https://www.extendoffice.com/documents/excel/2519-excel-countif-filtered-data.html explaining how to use SUMPRODUCT to get the information I want.

 

I hope this helps!

Highlighted

@JMB17 

I apologize for not attempting your formula prior to my previous reply but YES! This is EXACTLY what I was needing!! THANK YOU!

Highlighted
No worries. I'm glad that worked for you.
Highlighted

Hello @JMB17,

In attempts to understand the formula more, could I ask for an explanation of the formula's parts? I am hoping I can understand it and manipulate it for other needs (e.g., I need to know the total number of surveys. So, I hope I can I change it to just return cells that have anything in them from the filtered data on column E [Respondent ID]). I figured out how to manipulate the formula to collect the number of responses containing 4, 3, 2, and 1!

Highlighted
If you just need the total number of items in the filtered range, then I think

=SUBTOTAL(3,'Raw Data'!$F$2:$F$150)

should do the trick.
Highlighted
I can try to explain better how the formula works, but it probably won't be until later this evening.
Highlighted

Yes, @JMB17 !! This did work! Thank you!!

Highlighted

@dev1050 

 

I attached a file to try to illustrate how the formula is working. There is a tab with comments regarding how the functions are being used and also a tab with an example table that hopefully provides some useful illustration.

 

Also, here is a link to a site that includes additional explanation regarding the use of sumproduct in multiple condition tests that might also be helpful.

 

http://xldynamic.com/source/xld.SUMPRODUCT.html

Highlighted

@JMB17,

 

Thank you so much!!

Highlighted
You're quite welcome!