+ Reply to Thread
Results 1 to 8 of 8

How to ID data cols in formula when data col location move around in file

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    How to ID data cols in formula when data col location move around in file

    I have a file (see enclosed). In this file i am doing a countifs on specific cols (this is just an example file). What i want is to somehow use match (if possible) to identify the column to use in the countifs formula. The reason: I dont expect the "location" of the cols of data to stay the same.......i expect them to move around a bit.
    Attached Files Attached Files
    Last edited by welchs101; 07-12-2011 at 08:16 AM.

  2. #2
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to ID data cols in formula when data col location move around in file

    just wanted to provide a little clarification in case i confused anyone.

    on the 2nd sheet is a formula containing a countifs function. in this formula i concentrate on two cols of data...........data is located on sheet1. formula only works if the data stays in the right cols..........but what i want to do is somehow use like match or something such that header1 and header4 can be anywhere in the file and formula will still work.

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to ID data cols in formula when data col location move around in file

    since no one responded should i assume this is not possible and i should be gin looking for another alternative?

  4. #4
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to ID data cols in formula when data col location move around in file

    I found this

    MATCH("Header2",Data!1:1)


    But this gives the col #. What i need is the col ID like A, B, or C so that i can use it in a formula like this

    COUNTIFS(Data!A:A,"=" &"Junk1",Data!D:D,"=" & "Junk4")

    I need to replace A and D with something in case the locations of A and D change.

    doe sthis make sense?

  5. #5
    Valued Forum Contributor
    Join Date
    05-23-2011
    Location
    Lahore PK
    MS-Off Ver
    Excel 2007, 2013
    Posts
    627

    Re: How to ID data cols in formula when data col location move around in file

    Hi welchs101

    you can use the address function to pick up the column reference. Kindly see the attatched file.
    Attached Files Attached Files
    Last edited by Azam Ali; 07-12-2011 at 12:38 AM.

  6. #6
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to ID data cols in formula when data col location move around in file

    thanks i will take look at it today.

  7. #7
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: How to ID data cols in formula when data col location move around in file

    Very neat! But it looks like that formula wont work if cols go beyond A to Z. I guess i could modify the formula to extract everything prior to the "$" and then it might work for cols past "Z".

    Thanks for the info.......i learned something. Never knew abou tthe address function.

  8. #8
    Valued Forum Contributor
    Join Date
    05-23-2011
    Location
    Lahore PK
    MS-Off Ver
    Excel 2007, 2013
    Posts
    627

    Re: How to ID data cols in formula when data col location move around in file

    Hi welchs101

    column range is define in the match function i.e. "Data!$A$1:$K$1". You could change the range by replacing the K in the match funciton. e.g. if you replace K from Z than the formula will be effective upto Z column

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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