Solved

Function to return column heading number

Posted on 2012-03-14
9
182 Views
Last Modified: 2012-03-16
I would like to have a function that returns the number of the column in a table given I have provided the Header Name.  If this can be a inline function all the better.
0
Comment
Question by:StevenPMoffat
  • 4
  • 4
9 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37721730
Assuming that the headers are in row 1 you can use

=SUBSTITUTE(ADDRESS(1,MATCH("yourtitle",1:1,0),2),"$1","")

If it is some other row then change 1:1 to suit
0
 
LVL 42

Expert Comment

by:dlmille
ID: 37721935
You can use this array entered function (assuming your header is on row 1):

=MATCH(1,(1:1="Header_Name")*1,0)

type the function, then instead of hitting ENTER, Confirm with CTRL-SHIFT-ENTER

Dave
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 150 total points
ID: 37722041
Oops...column number...why not simply

=MATCH("Header_Name",1:1,0)
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 42

Expert Comment

by:dlmille
ID: 37722069
@ssaqibh - Good one.  While both are "correct" for finding the column header on the row, yours finds the last occurrence of that header, mine finds the first.  If there's only one, that last post is a winner!

Dave
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37722090
Dave, are you back from your vacation? Probably not....both formulas give same results.
0
 
LVL 42

Expert Comment

by:dlmille
ID: 37722144
If there are multiple occurrences then they yield results as I posted

Yep. I'm back it was a quickie
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37722157
Multiple occurences... both give same results.
0
 
LVL 42

Expert Comment

by:dlmille
ID: 37722180
Agree - I must have been looking cross-sighted :P
0
 

Author Closing Comment

by:StevenPMoffat
ID: 37729095
Very simple, thank you
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Converting ounces to grams - simple formula 8 42
How to strip out formula but retain value in cell 2 25
Cost allcocation ... 10 23
Excel 2007 VB Code for GCF 7 18
A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question