+ Reply to Thread
Results 1 to 2 of 2

Refer to Column Location Variable in Formula

  1. #1
    Registered User
    Join Date
    06-11-2011
    Location
    Carrboro, NC
    MS-Off Ver
    Excel 2010
    Posts
    32

    Question Refer to Column Location Variable in Formula

    I'm looking to create a macro that will perform a "countif" function in a separate worksheet, to end up with a frequency distribution. As my macro is currently written, the "countif" formula depends on this particular column being in the same place every time in the Raw Data worksheet, but this isn't exactly a reasonable assumption. I'd like the macro to be able to *find* the column first and then refer to that specific location in the formula.

    Here's what I have right now:

    Please Login or Register  to view this content.
    Of course, this doesn't work. Basically, I'm trying to get it to where the text that appears in the formula for the column reference (the "C[]" part of the formula) to use the column value that's returned in the "find" code above it. How do you refer to a variable name to act as a column reference within a function?

    Any help would be appreciated. Thanks!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2003,2007,2010
    Posts
    32,240

    Re: Refer to Column Location Variable in Formula

    I usually use MATCH to find a column number.

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Excel Aid

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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