vba - Excel or Access Count Occurrences -


i prefer solution in access not excel, have investigated both struggling find solution. here situation:- in access - 7 tables linked unique keys. each table has postcode, need find out how many duplicated postcodes there are. there no lead postcode compare against. example:-

rm9 6bg,rm9 6bg,rm10 9pl,rm9 6bg,rm9 6sr,rm9 6bg,rm9 6sr

result be:-

rm9 6bg = 4 rm10 9pl = 1 rm9 6sr = 2

sometimes tables have no value postcode if happens not want these counted part of duplicate groupings/counts. there 30+ thousand records. please no comments normalisation...

equivalent in excel:- conditional formatting "find duplicates" works on first row highlights them not group , count them, need added 30+ thousand rows? have tried various countif's no success.

all solutions welcome including vba.

without having full grasp on table structure (i.e. field names/table names/etc...) think way you're going achieve following:

  1. ensure have primary key/unique id each record. may require put autonumber field table.

  2. perform transpose query each record, go from:

    uid......pc1..............pc2................pc3................pc4...............etc....

    1..........rm9 6bg.....rm9 6bg.......rm10 9pl.......rm9 6sr

to

    uid        postalcode     1          rm9 6bg     1          rm9 6bg     1          rm10 9pl     1          rm9 6sr 
  1. perform union query on each transpose (i'm betting you'll have in loop because there's no way can have sql string long enough 30,000 times)

  2. perform group query on result, , count each postal code each uid.

i don't know how in more elegant way. mean, it's not horrible because can each step in loop (for x = 1 30000, select * uid=x, etc...) , append result table rather doing union query. group query on result table numbers.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -