Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Find the first or last populated column in a range

I have a range of data, from columns C through Z.
And I have about 100 rows of financial data. The rows represent
projects, and the columns represents periods where costs were
incurred. So, some rows have data from C-Z, and others have data from
H-M.

How can I write a formula in column a1, to tell me which was the first
column to have a value in row 1? And, likewise, I want to know which
column has the last value.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default Find the first or last populated column in a range

Commish wrote:
I have a range of data, from columns C through Z.
And I have about 100 rows of financial data. The rows represent
projects, and the columns represents periods where costs were
incurred. So, some rows have data from C-Z, and others have data from
H-M.

How can I write a formula in column a1, to tell me which was the first
column to have a value in row 1? And, likewise, I want to know which
column has the last value.


Array formula in A1 (commit with CTRL+SHIFT+ENTER):

=MIN(IF($C1:V1="","",COLUMN($C1:V1)))

Use MAX() for B1.
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Find the first or last populated column in a range

What type of data is in the cells? Text? Numbers? Both? Any formulas that
return formula blanks?

Exactly what result do you want? The column letter?


--
Biff
Microsoft Excel MVP


"Commish" wrote in message
...
I have a range of data, from columns C through Z.
And I have about 100 rows of financial data. The rows represent
projects, and the columns represents periods where costs were
incurred. So, some rows have data from C-Z, and others have data from
H-M.

How can I write a formula in column a1, to tell me which was the first
column to have a value in row 1? And, likewise, I want to know which
column has the last value.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Find the first or last populated column in a range

Commish wrote...
....
How can I write a formula in column a1, to tell me which was the first
column to have a value in row 1? And, likewise, I want to know which
column has the last value.


Most efficient ways

First column [array formula]: =MATCH(1,1-ISBLANK(C1:Z1),0)
Last column [array formula]: =MATCH(2,1/(1-ISBLANK(C1:Z1)))

If you want to treat cells evaluating to "" the same as blank (empty)
cells,

First column [array formula]: =MATCH(TRUE,C1:Z1<"",0)
Last column [array formula]: =MATCH(2,1/(C1:Z1<""))
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Find the first or last populated column in a range

On May 13, 4:42*pm, "T. Valko" wrote:
What type of data is in the cells? Text? Numbers? Both? Any formulas that
return formula blanks?

Exactly what result do you want? The column letter?

--
Biff
Microsoft Excel MVP

"Commish" wrote in message

...

I have a range of data, from columns C through Z.
And I have about 100 rows of financial data. The rows represent
projects, and the columns represents periods where costs were
incurred. So, some rows have data from C-Z, and others have data from
H-M.


How can I write a formula in column a1, to tell me which was the first
column to have a value in row 1? And, likewise, I want to know which
column has the last value.


Biff, the data is either numeric, or empty.

The column letter is fine, but ideally I'd want the value in a
specific row on the answer column.


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Find the first or last populated column in a range

Ok, in other words, you want to return the corresponding column headers for
the first numeric entry and last numeric entry in a row.

Assume column headers are in the range C1:Z1
Numeric data in the range C2:Z2 (includes empty cells)

For the first numeric entry, array entered** :

=IF(COUNT(C2:Z2),INDEX(C$1:Z$1,MATCH(TRUE,ISNUMBER (C2:Z2),0)),"")

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

For the last numeric entry:

=IF(COUNT(C2:Z2),INDEX(C$1:Z$1,MATCH(1E100,C2:Z2)) ,"")

If the column headers are dates, format the formula results as Date.

--
Biff
Microsoft Excel MVP


"Commish" wrote in message
...
On May 13, 4:42 pm, "T. Valko" wrote:
What type of data is in the cells? Text? Numbers? Both? Any formulas that
return formula blanks?

Exactly what result do you want? The column letter?

--
Biff
Microsoft Excel MVP

"Commish" wrote in message

...

I have a range of data, from columns C through Z.
And I have about 100 rows of financial data. The rows represent
projects, and the columns represents periods where costs were
incurred. So, some rows have data from C-Z, and others have data from
H-M.


How can I write a formula in column a1, to tell me which was the first
column to have a value in row 1? And, likewise, I want to know which
column has the last value.


Biff, the data is either numeric, or empty.

The column letter is fine, but ideally I'd want the value in a
specific row on the answer column.


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default Find the first or last populated column in a range

"Commish" wrote in message

...

I have a range of data, from columns C through Z.
And I have about 100 rows of financial data. The rows represent
projects, and the columns represents periods where costs were
incurred. So, some rows have data from C-Z, and others have data from
H-M.
How can I write a formula in column a1, to tell me which was the first
column to have a value in row 1? And, likewise, I want to know which
column has the last value.



On May 13, 4:42 pm, "T. Valko" wrote:
What type of data is in the cells? Text? Numbers? Both? Any formulas that
return formula blanks?

Exactly what result do you want? The column letter?

--
Biff
Microsoft Excel MVP


Commish wrote:
Biff, the data is either numeric, or empty.

The column letter is fine, but ideally I'd want the value in a
specific row on the answer column.



Which row?
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 display last entry in a column populated with #N/As T. Duprex Excel Worksheet Functions 4 January 12th 09 08:12 AM
Last populated cell in a column RedFive Excel Discussion (Misc queries) 1 October 3rd 08 09:01 PM
Last populated cell in a column RedFive Excel Discussion (Misc queries) 7 October 3rd 08 08:58 PM
LookUp to Display Last Value Populated a in Range sony654 Excel Worksheet Functions 13 May 11th 08 05:46 AM
Referencing last populated cell in a column flint Excel Worksheet Functions 2 April 28th 07 09:21 AM


All times are GMT +1. The time now is 01:54 PM.

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"