+ Reply to Thread
Results 1 to 7 of 7

How to use Countif function or any other formula to sort YEAR . Country And any occurrenc!

  1. #1
    Registered User
    Join Date
    01-11-2019
    Location
    London
    MS-Off Ver
    2017
    Posts
    4

    How to use Countif function or any other formula to sort YEAR . Country And any occurrenc!

    My Data looks like this:

    Year Country
    2000 Afghanistan
    2000 Afghanistan
    2000 India
    2000 Malaysia
    2001 Afghanistan
    2001 Afghanistan
    2001 India
    2001 India
    2001 India

    What I need to do is to sort data like this:

    Year Country Occurrence
    2000 Afghanistan 2
    2000 India 1
    2000 Malaysia 1
    2001 Afghanistan 2
    2001 India 3


    the occurrence is basically how many times a year has been repeated in the data-set. What is the best formula for this? Many thanks in Advance.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,679

    Re: How to use Countif function or any other formula to sort YEAR . Country And any occurr

    It would help if you attached a sample Excel workbook, as no-one likes to spend time entering your sample data into Excel before being able to try out a few ideas.

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post. Don't try to use the Paperclip icon, as it doesn't work on this forum.

    Hope this helps.

    Pete

  3. #3
    Valued Forum Contributor
    Join Date
    11-02-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    459

    Re: How to use Countif function or any other formula to sort YEAR . Country And any occurr

    i prefer Pivot Tables. Data must be uniform (Ex India with a space at the end is different than India without a space). In pivot table: Column = Year; Rows = Country and Values = Count of Country. This will give you a nice summarized table

  4. #4
    Valued Forum Contributor
    Join Date
    05-11-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    586

    Re: How to use Countif function or any other formula to sort YEAR . Country And any occurr

    Hi Aijaz,

    I agree with queuesef - please see Pivot Table attached.

    Regards

    peterrc
    Attached Files Attached Files

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: How to use Countif function or any other formula to sort YEAR . Country And any occurr

    Hello aijaz75. Welcome to the forum.

    Try copy/paste data in column A:B to column D:E. Apply Remove Duplicates feature. Then this formula in F2 and fill down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.




    A
    B
    C
    D
    E
    F
    1
    Year
    Country
    Year
    Country
    2
    2000
    Afghanistan
    2000
    Afghanistan
    2
    3
    2000
    Afghanistan
    2000
    India
    1
    4
    2000
    India
    2000
    Malaysia
    1
    5
    2000
    Malaysia
    2001
    Afghanistan
    2
    6
    2001
    Afghanistan
    2001
    India
    3
    7
    2001
    Afghanistan
    8
    2001
    India
    9
    2001
    India
    10
    2001
    India
    Dave

  6. #6
    Registered User
    Join Date
    01-11-2019
    Location
    London
    MS-Off Ver
    2017
    Posts
    4

    Re: How to use Countif function or any other formula to sort YEAR . Country And any occurr

    Many thanks all of you. It really helped.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: How to use Countif function or any other formula to sort YEAR . Country And any occurr

    You're welcome. Glad to help. Thanks for the feedback.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 01-25-2016, 08:10 AM
  2. [SOLVED] Listing GDPgrowth % to correspong country and year
    By dbven in forum Excel General
    Replies: 1
    Last Post: 01-14-2016, 09:28 AM
  3. CountIF and Sort Function
    By keerthivasan.u in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-05-2013, 07:55 AM
  4. How to align data based on country and year?
    By gregthewang in forum Excel General
    Replies: 1
    Last Post: 11-06-2012, 02:31 AM
  5. Replies: 6
    Last Post: 05-11-2012, 12:01 PM
  6. Add ‘country name’ column to worksheet from a list of country codes.
    By Ben Morton in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2009, 09:24 AM
  7. Using Countif Function with the Month & Year Function
    By laya1024 in forum Excel General
    Replies: 3
    Last Post: 02-03-2009, 07:52 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1