Results 1 to 15 of 15

Thread: How to determine best months for Products

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Administrator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,302
    Location
    Just for fun, I thought I would challenge myself to create a formula to do the same. Like I said, just for fun and not the practical solution Paul has offered up.

    =LET(
       yr,A1,
       rng,B3:Y33,
       dim,DAY(EOMONTH(DATE(yr,SEQUENCE(,12),1),0)),
       lz,IF(rng="","",rng),
       d,HSTACK(TOCOL(CHOOSECOLS(lz,SEQUENCE(,12,1,2)),,1),TOCOL(CHOOSECOLS(lz,SEQUENCE(,12,2,2)),,1)),
       dt,TOCOL(DATE(yr,SEQUENCE(,12),SEQUENCE(31)),,1),
       t,HSTACK(dt,d),
       data,FILTER(t,(INDEX(t,,2)<>"")+(INDEX(t,,3)<>"")),
       sdta,HSTACK(data,IF(INDEX(data,,3)>=29.5,1)),
       abv29half,DROP(PIVOTBY(,MONTH(INDEX(sdta,,1)),INDEX(sdta,,4),COUNT),1,-1),
       abv29halpc,TEXT(abv29half/dim,"0%"),
       tdta,HSTACK(data,IF(INDEX(data,,2)<=10,1)),
       below10,DROP(PIVOTBY(,MONTH(INDEX(tdta,,1)),INDEX(tdta,,4),COUNT),1,-1),
       below10pc,TEXT(below10/dim,"0%"),
       udta,HSTACK(data,IF(INDEX(data,,2)<=12,1)),
       below12,DROP(PIVOTBY(,MONTH(INDEX(udta,,1)),INDEX(udta,,4),COUNT),1,-1),
       below12pc,TEXT(below12/dim,"0%"),
       vdta,HSTACK(data,IF(INDEX(data,,2)<=15,1)),
       below15,DROP(PIVOTBY(,MONTH(INDEX(vdta,,1)),INDEX(vdta,,4),COUNT),1,-1),
       below15pc,TEXT(below15/dim,"0%"),
       tbl,VSTACK(abv29half,abv29halpc,below10,below10pc,below12,below12pc,below15,below15pc),
       final,IF(VALUE(tbl)=0,"",tbl),
       mnths,HSTACK("",TEXT(DATE(yr,SEQUENCE(,12,1,1),1),"mmm")),
       rws,TOCOL({">= 29.5",">= 29.5 %","<= 10","<= 10 %","<= 12","<= 12 %","<= 15","<= 15 %"}),
       VSTACK(mnths,HSTACK(rws,final))
    )
    Attached Files Attached Files
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2408, Build 17928.20080

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •