Solved

Function to return column heading number

Posted on 2012-03-14
9
181 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 41

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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 41

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 41

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 41

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
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…

778 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