Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How do I find a column number for a cell containing a value

Hi,
I have a range of cells A1:CZ1 all of which have different values. I
need to find the column number for a cell that contains a certain value.
I know I can use cells.find which returns the value rather than the cell
reference, and I have seen other posts in this group to return a number when
the cell is known range(ColAddress).cells(1,1).column

I can easily put this in a simple loop but I was wondering if there was a
smarter way that could do it in one line using built-in functions. If it
was a loop it would have to be processed many times for the different values
I need to lookup slowing things down quite a bit.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default How do I find a column number for a cell containing a value

cells.find can be used to return a row/column number or address or any number
of other properties the cell might have.

myRow = cells.find(What:="Joe Smith").row
myCol = cells.find(What:="Joe Smith").column
myAddr = cells.find(What:="Joe Smith").address


"Gilgamesh" wrote:

Hi,
I have a range of cells A1:CZ1 all of which have different values. I
need to find the column number for a cell that contains a certain value.
I know I can use cells.find which returns the value rather than the cell
reference, and I have seen other posts in this group to return a number when
the cell is known range(ColAddress).cells(1,1).column

I can easily put this in a simple loop but I was wondering if there was a
smarter way that could do it in one line using built-in functions. If it
was a loop it would have to be processed many times for the different values
I need to lookup slowing things down quite a bit.

Thanks

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default How do I find a column number for a cell containing a value

Hello,
Enter formula in A2:
=if(a1=value($A$5),$A$5,"")
copy this formula from B2 to CZ1 by dragging.
Enter a number in A5, say 12.
You will see all your entries A1:CZ1 that contain a 12.

Regards,

Gabor Sebo




"Gilgamesh" wrote in message
...
Hi,
I have a range of cells A1:CZ1 all of which have different values. I
need to find the column number for a cell that contains a certain value.
I know I can use cells.find which returns the value rather than the cell
reference, and I have seen other posts in this group to return a number
when the cell is known range(ColAddress).cells(1,1).column

I can easily put this in a simple loop but I was wondering if there was a
smarter way that could do it in one line using built-in functions. If it
was a loop it would have to be processed many times for the different
values I need to lookup slowing things down quite a bit.

Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How do I find a column number for a cell containing a value


"B Lynn B" wrote in message
...
cells.find can be used to return a row/column number or address or any
number
of other properties the cell might have.

myRow = cells.find(What:="Joe Smith").row
myCol = cells.find(What:="Joe Smith").column
myAddr = cells.find(What:="Joe Smith").address


Thank You



"Gilgamesh" wrote:

Hi,
I have a range of cells A1:CZ1 all of which have different values. I
need to find the column number for a cell that contains a certain value.
I know I can use cells.find which returns the value rather than the cell
reference, and I have seen other posts in this group to return a number
when
the cell is known range(ColAddress).cells(1,1).column

I can easily put this in a simple loop but I was wondering if there was a
smarter way that could do it in one line using built-in functions. If it
was a loop it would have to be processed many times for the different
values
I need to lookup slowing things down quite a bit.

Thanks

.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default How do I find a column number for a cell containing a value

Hello,

I wrote a VBA program and inserted a:12 in columns 1,6,11,30,92 and 104.
The outputs are column numbers (1,6,...104) and the columns for these 12.s:
A,F,K,AD,CN and CZ.
The output is unsophisticated.

best regards,

Gabor Sebo
worksheet encl.



"Gilgamesh" wrote in message

"Gilgamesh" wrote in message
...
Hi,
I have a range of cells A1:CZ1 all of which have different values. I
need to find the column number for a cell that contains a certain value.
I know I can use cells.find which returns the value rather than the cell
reference, and I have seen other posts in this group to return a number
when the cell is known range(ColAddress).cells(1,1).column

I can easily put this in a simple loop but I was wondering if there was a
smarter way that could do it in one line using built-in functions. If it
was a loop it would have to be processed many times for the different
values I need to lookup slowing things down quite a bit.

Thanks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula to find the last number of a column (lower cell) yiannis5231 Excel Discussion (Misc queries) 1 April 21st 10 07:10 AM
Find column number of last used cell in a row KG Old Wolf Excel Programming 5 September 26th 09 10:48 PM
Find previous number and find next number in column DoubleZ Excel Discussion (Misc queries) 4 March 4th 09 08:51 PM
Find DMIN in a column range determined by a number in another cell dlbeiler Excel Worksheet Functions 0 October 11th 07 07:09 PM
Find cell below last number in a column Two-Canucks Excel Programming 5 May 20th 06 12:45 AM


All times are GMT +1. The time now is 02:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"