Solved

Function to return column heading number

Posted on 2012-03-14
9
179 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
 
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

758 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now