• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Conditional Unique Codes

JUES

New Member
Good afternoon friends

Using the UNIQUE function, I am extracting unique codes from Sheet3 (MATRIZ). However, the function only returns raw results, meaning all the unique codes within the ranges I am analyzing, regardless of month or year, as shown in the “Current Result” Table on Sheet1 (USUARIOS & PRIVILEGIOS), likewise the UNIQUE function shows empty cells as zero, there is no way to display the result as in the “Expected Results” Table of Sheet1 (USUARIOS & PRIVILEGIOS)

The calculation I intend to perform is done with a one-month delay; that is, Diciembre is calculated in Enero, Enero in Febrero, and so on. However, when calculating a month, for example, Diciembre 2025, codes corresponding to Enero 2026 may already have been registered (not counting codes from other months and years previously registered). Therefore, the Month and Year (Columns Y and Z) of the codes to be searched for within Sheet3 (MATRIZ) must match the Month and Year (Cells C10 and C11) of Sheet62 FORMATO so that the result reflected in the “Expected Results” Table to be accurate, since, as you can see, cells C10 and C11 of Sheet62 FORMATO are one month behind the current date.

Using Windows 11 Home, Office LTSC Standard, 2011

I would be very grateful for any help you can give me.
 

Attachments

Could You combine Y & Z-columns in ONE column eg Z-column and add there day part too?
Eg row 3
>>> if Diciembre is same as ... (I can only guess this.) December then Z-column will be 1/12/2025 (day/month/year ... or how do You use dates?).
After that - real dates are more useful for use and it can format to look as You would like to have eg Diciembre 2025.
Questions:
Which dates values do You expect to get?
Is that a one-month delay automatic?
... Could user set own date (month year)?
... ... if someone would like to get output two months later ... is it mission possible?
 
maybe something like
=UNIQUE(FILTER(MATRIZ!AV3:AV23,((MATRIZ!AV3:AV23<>"")*(MATRIZ!Y3:Y23="Enero")*(MATRIZ!Z3:Z23=FORMATO!C11))))
BUT instead of "Enero" use the cell reference

But you expected results in Cr7 is for "Enero" and not Decemberi n C10 , But then you did not have december in those cells in Y3:Y20 - but Diciembre
so i'm a little confused

if in CJ7 i use
=UNIQUE(FILTER(MATRIZ!AI3:AI23,((MATRIZ!AI3:AI23<>"")*(MATRIZ!Y3:Y23=FORMATO!C10)*(MATRIZ!Z3:Z23=FORMATO!C11))))
then taht does not match you expected results

so i'm confused on what we are doing with the year and month requirement - BUT at least you get the idea that you filter the results to the columns you want and then use unique

probably do with LET() or maybe choosecols()

I replaced Diciembre with december
probably better to use dates
 

Attachments

Greetings Mr. @ETAF

Following your questions and those of Mr. @vletm, I made the corrections to the month and year, and the formula works perfectly, please excuse me if my writing isn't the most specific and thorough; English isn't my native language.

=UNICOS(FILTRAR(MATRIZ!AV3:AV23;((MATRIZ!AV3:AV23<>"")*(MATRIZ!$Y3:$Y23=FORMATO!$C$10)*(MATRIZ!$Z3:$Z23=FORMATO!$C$11))))
 
Back
Top