Consulting

Results 1 to 3 of 3

Thread: Strange formula - now sure how it works

  1. #1

    Strange formula - now sure how it works

    Hi,

    The following formula counts the unique values in a coulumn. The formula works fine but I am not sure how it works.
    I understand how the SUMPRODUCT and COUNTIF functions work. However, I don't understand two things in the following formula.

    1. Why is there a division sign (/) in the formula?
    2. What is the meaning of the criteria part of the COUNTIF function?


    =SUMPRODUCT((E22:E27<>"") / COUNTIF(E22:E27,E22:E27&""))

    Thanks,

    MG.


    Cross posted at http://www.mrexcel.com/forum/showthread.php?t=523476

  2. #2
    Hi,

    Criteria part of Countif means the values in Each cell of the range.
    Hence the Countif returns count of each cell values

    condition (E22:E27<>"") returrns True for nonblank cells.( True = 1)


    i.e True(1) is divided by count of each cell values
    and then sum of all which evaluates to count of unique values in the range.

    Hope it will be useful to undertand the formula.
    khushii

  3. #3
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    you may find an answer:

    http://www.mrexcel.com/forum/showthread.php?t=70835


    ps: cross replied....
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

Posting Permissions

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