+ Reply to Thread
Results 1 to 6 of 6

Vlookup & Count Function

  1. #1
    Registered User
    Join Date
    08-23-2012
    Location
    Toronto, ON
    MS-Off Ver
    Excel 2010
    Posts
    8

    Vlookup & Count Function

    HI, EXCEL Formula Question:

    I have an array which is a list of postal codes, and a count number in the adjacent column.

    I'm looking to write a vlookup function which will return the total sum, for the specific for the first three characters.

    e.g. dataset:
    K1N 6B4 31
    K0A 2W0 30
    K0A 1A0 26
    K0A 1W0 20
    K2G 1V8 19
    K2T 1H2 17


    So, "KOA" = 76 (30+26+20).

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Vlookup & Count Function

    Hi
    you can use the following formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Vlookup & Count Function

    Not clear exactly what you want.

    Assuming this data is in the range A2:B7, then in C2 enter this formula and copy down.

    =SUMPRODUCT(--((LEFT($A$2:$A$7,3)=LEFT(A2,3))*$B$2:$B$7))

    You will find the totals are calculated - (you will have 76 next to all the KOA codes).

    Please advise if you want more sophistication!

    I hope this helps, please let me know!

    Regards,

    David


    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".


  4. #4
    Registered User
    Join Date
    08-23-2012
    Location
    Toronto, ON
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Vlookup & Count Function

    =SUMPRODUCT(--((LEFT($A$2:$A$7,3)=LEFT(A2,3))*$B$2:$B$7))

    works perfectly! Thanks David!

  5. #5
    Registered User
    Join Date
    08-23-2012
    Location
    Toronto, ON
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Vlookup & Count Function

    Hi,

    It seems the forumula only works on a smaller dataset.

  6. #6
    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: Vlookup & Count Function

    ianarman,

    Try expanding the range references. Ex: A2:A100, B2:B100.
    Dave

+ 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: 17
    Last Post: 04-11-2016, 11:14 PM
  2. User defined function- count color and count only visible rows
    By marsjanik1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2016, 03:05 PM
  3. [SOLVED] Vlookup and count function.
    By moonbreakker in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-20-2015, 09:37 AM
  4. [SOLVED] VLookup combined with Count / Sum Function
    By AdamPhillip in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-13-2014, 03:18 PM
  5. Using the COUNT function to count letters generated by an IF function
    By SMErickson7 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-28-2013, 12:02 PM
  6. [SOLVED] Vlookup and count function
    By Kezwick in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-05-2012, 04:15 PM
  7. Multiple function count and vlookup
    By Abaldwin22 in forum Excel General
    Replies: 1
    Last Post: 04-28-2009, 09:35 AM

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