Search code examples
dategoogle-sheetsimportgoogle-sheets-formulagoogle-query-language

Adding importrange to existing IFERROR(TEXT(MODE(ARRAYFORMULA(WEEKDAY(FILTER formula


I have this formula which does what I need to find the mode day within the filter.

=IFERROR(TEXT(MODE(ARRAYFORMULA(WEEKDAY(FILTER(June!X$3:X,June!P$3:P=A3,June!X$3:X<>"")))),"dddd"))

I need the sheet 'June!' to sit within a different workbook because the dataset is so large. Therefore, I need to use import range within this same formula with URL,'June!' but I am not sure how to make this work.

Any ideas please?


Solution

  • try:

    =INDEX(TEXT(QUERY({IMPORTRANGE("1xNFVHLnQGkRgZdLmejCyU0BByOPBY8NMoIYj6SkTFGY", "June!P3:X")}, 
     "select Col9 
      where Col1 = '"&A3&"' 
        and Col9 is not null", 0), "dddd"))
    

    enter image description here


    update:

    =INDEX(QUERY(TEXT(QUERY({IMPORTRANGE("1xNFVHLnQGkRgZdLmejCyU0BByOPBY8NMoIYj6SkTFGY", "June!P3:X")}, 
     "select Col9 
      where Col1 = '"&A3&"' 
        and Col9 is not null", 0), "dddd"), "select Col1,count(Col1) group by Col1 order by count(Col1) desc"), 2, 1)
    

    enter image description here