Forum Discussion

Shivashimladka's avatar
Shivashimladka
Copper Contributor
Apr 29, 2022

How to Count of invoice numbers in a column

How do we count date wise total invoices from the below table (without counting duplicates)

 

I have tried this formula =SUM(IF(FREQUENCY(C14:C24,C14:C24)>0,1)) but this gives total counts (excl duplicates) irrespective of date

 

DateInv Number
24-04-20221
24-04-20222
24-04-20222
24-04-20222
25-04-20226
25-04-202288
25-04-202288
28-04-202254
28-04-202254
28-04-202259
28-04-202259
  
  • KatieMcAdams's avatar
    KatieMcAdams
    Copper Contributor

    Shivashimladka Can you help with counting these please?  The data is in L3:L17

    XCT22-2494-01
    XCT22-2494-02
    XCT22-2494-03
    XCT22-2494-03
    XCT22-2494-03
    XCT22-2494-03
    XCT22-2494-04
    XCT22-2494-04
    XCT22-2494-04
    XCT22-2494-04
    XCT22-2494-04
    XCT22-2494-05
    XCT22-2494-05
    XCT22-2494-06
    XCT22-2494-06

    • HansVogelaar's avatar
      HansVogelaar
      MVP

      KatieMcAdams 

      Do you want to count unique values?

      If you have Excel 2021 or 365:

      =COUNTA(UNIQUE(L3:L17))

      If you have an older version, as an array formula confirmed with Ctrl+Shift+Enter:

      =SUMPRODUCT(1/COUNTIF(L3:L17,L3:L17))

  • Shivashimladka 

    I have come to the conclusion that building the entire array of dates and counts in one formula overcomplicates things.  So, given the distinct dates in a spilt range

    = MAP(distinctDate#,
          LAMBDA(d, COUNTA(
              UNIQUE(FILTER(invoice, invoiceDate=d))
          ))
      )
  • Shivashimladka 

    A solution is to make sure you have access to Excel 365 and write the formula

    = LET(
        date,  UNIQUE(sourceDate),
        count, COUNTIFS(sourceDate,date),
        HSTACK(date, count)
      )

     

     

    • PeterBartholomew1's avatar
      PeterBartholomew1
      Silver Contributor

      Sorry, misread the question.

      = LET(
          distinctInv, UNIQUE(sourceData),
          invDate,     TAKE(distinctInv, ,1),
          date,        UNIQUE(sourceDate),
          count,       MAP(date, LAMBDA(d, 
                           COUNT(IF(invDate=d, 1)))),
          HSTACK(date, count)
        )

    • Shivashimladka's avatar
      Shivashimladka
      Copper Contributor

      HansVogelaar  Thank you Hans Vogelaar. This gives me count of invoices, but not date wise?

       

      Need to fill the below table (invoice count date wise)

       

      DateCount of inv
      24-04-2022?? 
      25-04-2022?? 
      28-04-2022??

       

      Data for filling the above table - 

       

      DateInv Number
      24-04-20221
      24-04-20222
      24-04-20222
      24-04-20222
      25-04-20226
      25-04-202288
      25-04-202288
      28-04-202254
      28-04-202254
      28-04-202259
      28-04-202259

       

       

      • OliverScheurich's avatar
        OliverScheurich
        Gold Contributor

        Shivashimladka 

        =SUM(N(IF($A$5:$A$15=D7,MATCH(IF($A$5:$A$15=D7,$B$5:$B$15),IF($A$5:$A$15=D7,$B$5:$B$15),)=ROW($1:$11))))

        An alternative could be this formula. Enter the formula with ctrl+shift+enter if you don't work with Office365 or 2021. 

Resources