Assume given data is in Google sheets column c, write me single formula to show…
- User
Assume given data is in Google sheets column c, write me single formula to show duplicate month name which appear more than once 4-Feb-1999 6-Mar-1999 5-Apr-1999 5-May-1999 4-Jul-1999 2-Sep-1999 2-Oct-1999 31-Dec-1999 20-Feb-1999 22-Mar-1999 21-Apr-1999 21-May-1999 20-Jul-1999 18-Sep-1999 18-Oct-1999 16-Jan-2000
In this example feb appeared more than once so write me formula that show duplicate month name along with date
- Assistant
To find and display duplicate month names along with the dates in Google Sheets, you can use a combination of
QUERY,TEXT,COUNTIF, andFILTERfunctions. Here's a single formula that would achieve this:=QUERY(FILTER(C:C & " " & TEXT(C:C, "mmm-yyyy"), COUNTIF(TEXT(C:C, "mmm"), TEXT(C:C, "mmm")) > 1), "where Col1 is not null", 0)Let's break down the formula:
-
TEXT(C:C, "mmm"): This part of the formula converts the dates in column C to a text format showing only the month abbreviation (e.g., "Feb"). -
COUNTIF(TEXT(C:C, "mmm"), TEXT(C:C, "mmm")) > 1: This counts how often each month appears in the column. It compares each month to the list of months and returns an array with counts. We are interested in months that appear more than once, hence the .
-
- User
#ERROR!
- Assistant
Apologies for the confusion. Let's try a different approach to obtain the desired result. We'll use the following array formula that combines the
UNIQUE,TEXT,COUNTIF, andFILTERfunctions to identify and list the dates with the names of months that appear more than once:=UNIQUE(FILTER(C1:C16, COUNTIF(TEXT(C1:C16, "mmm"), TEXT(C1:C16, "mmm"))>1))Here's how this formula works:
-
TEXT(C1:C16, "mmm"): This part converts the dates in the rangeC1:C16into a text string representing only the month. -
COUNTIF(TEXT(C1:C16, "mmm"), TEXT(C1:C16, "mmm")): This counts the number of times each month appears within the same column. -
FILTER(C1:C16, ...): TheFILTERfunction is used here to return the dates from the original range where the corresponding month appears more than once.
-
- User
Formula perse error
- Assistant
Apologies for the confusion earlier. Let's revise the approach to list and extract the duplicate months along with the dates from column C in Google Sheets.
Since the array formula approach has led to an error, we will try a different formula structure to get the desired output:
=QUERY(ARRAYFORMULA({C:C, TEXT(C:C, "mmm-yyyy")}), "SELECT Col1 WHERE Col1 IS NOT NULL AND Col2 IN (SELECT Col2 FROM (SELECT COUNT(Col2) as cnt, Col2 FROM QUERY(ARRAYFORMULA({C:C, TEXT(C:C, "mmm-yyyy")}), 'SELECT Col2 WHERE Col1 IS NOT NULL GROUP BY Col2') WHERE cnt > 1) )")Let's break down this formula:
-
: This part creates a two-column array, where the first column is the original dates and the second column is the month and year extracted from the dates.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.