SOLVED

Counta or Countif for 1 range but multiple criteria

%3CLINGO-SUB%20id%3D%22lingo-sub-2359233%22%20slang%3D%22en-US%22%3ECounta%20or%20Countif%20for%201%20range%20but%20multiple%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2359233%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20there%2C%3C%2FP%3E%3CP%3EApologies%20if%20this%20has%20already%20been%20asked%20but%20I%20can't%20seem%20to%20find%20an%20answer.%20I%20have%20a%20MS%20Forms%20that%20Power%20Automates%20specific%20answers%20from%20various%20questions%20into%20a%20a%20table%20within%20a%20workbook.%20Some%2C%20not%20all%2C%20questions%20are%20populated%20into%20the%20workbook%20table%2C%20where%20each%20question%20that%20is%20extracted%20into%20the%20workbook%2C%20is%20represented%20by%20a%20column.%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20use%20COUNTA%20or%20COUNTIF%20in%20a%20different%20worksheet%20within%20the%20same%20workbook.%20I%20am%20attempting%20to%20use%20COUNTIF%2FCOUNTA%20for%20the%20range%20of%20column%20D%20of%20sheet%20one%20in%20reference%20to%20the%20date%20of%20the%20form%20submission.%20Column%20D%20has%20entries%20in%20cells%20that%20start%20with%20brackets%2C%20eg.%20%5B%221%22%2C%20%222%22%5D.%20For%20instance%2C%20in%20table%201%20-%20worksheet%201%2C%20the%20same%20date%20can%20appear%20multiple%20times%20for%20various%20rows%20in%20sequence%20for%20different%20submissions.%20In%20worksheet%202%20-%20column%20B%20(not%20a%20table)%2C%20there%20can%20only%20be%20one%20date%20for%20each%20row%20(also%20in%20ascending%20sequence).%20COUNTIF%20usually%20works%2C%20but%20for%20some%20reason%20it's%20not%20working%20for%20this%20situation.%20I%20thought%20maybe%20COUNTA%20could%20work%20if%20paired%20with%20a%20IF%20function%20of%20sorts%2C%20but%20so%20far%20I%20can't%20find%20a%20functional%20solution.%20Any%20suggestions%20please%3F%3CBR%20%2F%3E%3CBR%20%2F%3EFor%20clarity%3A%20Range%20%3D%20Column%20D%2C%20Criteria%201%20%3D%20non-blank%20cells%20of%20column%20D%2C%20Criteria%202%20%3D%20Date%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%2C%3CBR%20%2F%3E%3CBR%20%2F%3EEdit%3A%20Added%20the%20for%20clarity%20sentence%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2359233%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%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2359395%22%20slang%3D%22en-US%22%3ERe%3A%20Counta%20or%20Countif%20for%201%20range%20but%20multiple%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2359395%22%20slang%3D%22en-US%22%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F156456%22%20target%3D%22_blank%22%3E%40Faraz%20Shaikh%3C%2FA%3E%3CBR%20%2F%3EI%20will%20attach%20a%20sample%20dataset%20that%20mimics%20some%20parts%20of%20my%20problem.%20In%20this%20case%2C%20column%20K%20is%20the%20range%20that%20I'm%20trying%20to%20count%20without%20success%20with%20respect%20to%20the%20given%20date.%3C%2FLINGO-BODY%3E
New Contributor

Hi there,

Apologies if this has already been asked but I can't seem to find an answer. I have a MS Forms that Power Automates specific answers from various questions into a a table within a workbook. Some, not all, questions are populated into the workbook table, where each question that is extracted into the workbook, is represented by a column.

I am trying to use COUNTA or COUNTIF in a different worksheet within the same workbook. I am attempting to use COUNTIF/COUNTA for the range of column D of sheet one in reference to the date of the form submission. Column D has entries in cells that start with brackets, eg. ["1", "2"]. For instance, in table 1 - worksheet 1, the same date can appear multiple times for various rows in sequence for different submissions. In worksheet 2 - column B (not a table), there can only be one date for each row (also in ascending sequence). COUNTIF usually works, but for some reason it's not working for this situation. I thought maybe COUNTA could work if paired with a IF function of sorts, but so far I can't find a functional solution. Any suggestions please?

For clarity: Range = Column D, Criteria 1 = non-blank cells of column D, Criteria 2 = Date

 

Thank you,

Edit: Added the for clarity sentence

4 Replies

Hi @DCexcels 

 

Could you please attach a sample dataset to advise you correct solution 

 

Regards, Faraz Shaikh | MCT, MIE, MOS Master, Excel Expert

If you find the above solution resolved your query don't forget mark as Official/Best Answer & like it to help the other members find it more.

Hi @Faraz Shaikh
I will attach a sample dataset that mimics some parts of my problem. In this case, column K is the range that I'm trying to count without success with respect to the given date.
best response confirmed by DCexcels (New Contributor)
Solution

Hi @DCexcels 

 

The formula should read like this a below, where you need to use COUNTIFS with multiple criterias 

  1. Count the values between the date range
  2. Count value which are not equals to blank
  3. Count Based on your product
=COUNTIFS(Table1[Date Reformatted],">="&$B2,Table1[Date Reformatted],"<="&$B2,Table1[Which tomatoe edition?],"<>",Table1[What does the client want],"tomatoes")

 

So I have added additional column when you have product reads as "Tomatoes and Apples", if you don't like that then you just add those values using the same logics of countifs that is showed in sheet3

 

2021-05-17_04-17-23.png

 

Attached is the sample file.

 

Regards, Faraz Shaikh | MCT, MIE, MOS Master, Excel Expert

If you find the above solution resolved your query don't forget mark as Official/Best Answer & like it to help the other members find it more.

Hi @Faraz Shaikh
Thank you for the solution. This was very helpful! I'm still new to excel functions but having a lot of fun learning the syntax.
Stay safe,
Aaron