In row B1:CP1 are dates of the month. In B4:CP4 I have entered continous values using…
- User
In row B1:CP1 are dates of the month. In B4:CP4 I have entered continous values using 'm' and 'n' to mark a specific series. The following formula accurately provides me the date of the start of the series
=IFERROR(IF(COUNTIF(B4:CO4,"m")>0,INDEX(1:1,MATCH("m",B4:CO4,0)),""),"")
The formula below does not provide me an accurate date of the of the end of the series =IFERROR(IF(COUNTIF(B4:CP4, "m") + COUNTIF(B4:CP4, "n") > 0,INDEX(1, MATCH(TRUE, COUNTIF(B4:CP4, {"m","n"}) > 0, 0)),""),"")
- Assistant
It looks like you're trying to find the end date of a series marked by "m" and "n" in the range B4:CP4. However, the formula you provided to find the end date is not set up correctly for that purpose.
Let’s break this down:
-
Start Date: You already have a working formula to find the start date of the series marked by "m". This works correctly by looking for the first "m" in your row.
-
End Date: For the end date, we need to find the last occurrence of either "m" or "n" and then return the corresponding date.
Here’s a revised formula to help you find the end date of the series:
=IFERROR(INDEX($B$1:$CP$1, MAX(IF(B4:CP4={"m","n"}, COLUMN(B4:CP4)-COLUMN(B4)+1))), "")To break it down:
IF(B4:CP4={"m","n"}, COLUMN(B4:CP4)-COLUMN(B4)+1)creates an array of column indices where "m" or "n" appears.MAX(...)gets the maximum index from that list, which corresponds to the last occurrence of "m" or "n".
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.