Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
CEG CEG is offline
external usenet poster
 
Posts: 29
Default Find last column with data, but with headers and a total row

I have a spreadsheet with multiple months across the top, rows for data entry
and a total row at the bottom. There may be months with no data, followed by
months with data. For example:

1/07 2/07 3/07 4/07 5/07 6/07
1 3 4
5 6 7
total 6 0 9 7 4 0

I need a formula or macro to find the last column with data and return the
month from the column header (i.e. "5/07")

Probably simple, but I can't figure it out. I'm using Excel 2003.
--
CG
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default Find last column with data, but with headers and a total row

try (assuming dates start in B1):

=INDEX($B$1:$G$1,0,MAX((B2:G2<"")*COLUMN($B$1:$G$ 1))-1)

Enter with Ctrl+Shift+Enter (*array formula*). You will get {} surrounding
the formula.

"CEG" wrote:

I have a spreadsheet with multiple months across the top, rows for data entry
and a total row at the bottom. There may be months with no data, followed by
months with data. For example:

1/07 2/07 3/07 4/07 5/07 6/07
1 3 4
5 6 7
total 6 0 9 7 4 0

I need a formula or macro to find the last column with data and return the
month from the column header (i.e. "5/07")

Probably simple, but I can't figure it out. I'm using Excel 2003.
--
CG

  #3   Report Post  
Posted to microsoft.public.excel.misc
CEG CEG is offline
external usenet poster
 
Posts: 29
Default Find last column with data, but with headers and a total row

I had to tweak it a bit because I wasn't really starting in column A, but
once I changed the -1 at the end to -10, it works!

I don't completely understand it, but I'll figure it out later. Thanks a
bunch!
--
CG


"Toppers" wrote:

try (assuming dates start in B1):

=INDEX($B$1:$G$1,0,MAX((B2:G2<"")*COLUMN($B$1:$G$ 1))-1)

Enter with Ctrl+Shift+Enter (*array formula*). You will get {} surrounding
the formula.

"CEG" wrote:

I have a spreadsheet with multiple months across the top, rows for data entry
and a total row at the bottom. There may be months with no data, followed by
months with data. For example:

1/07 2/07 3/07 4/07 5/07 6/07
1 3 4
5 6 7
total 6 0 9 7 4 0

I need a formula or macro to find the last column with data and return the
month from the column header (i.e. "5/07")

Probably simple, but I can't figure it out. I'm using Excel 2003.
--
CG

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
Total column changes colors when total equals sum of other columns newstacy New Users to Excel 1 April 21st 07 09:00 PM
Excel - returning column headers in a seperate column ExcelConfused Excel Discussion (Misc queries) 1 March 28th 06 02:49 PM
find text in column h and total the corresponding numbers if colum adelaide Excel Discussion (Misc queries) 2 February 6th 06 04:47 AM
total a colum using data from another column Duffey Excel Worksheet Functions 5 August 30th 05 06:32 AM
Adding total dollars based on specific data from another column Espo Excel Discussion (Misc queries) 1 June 13th 05 07:52 PM


All times are GMT +1. The time now is 05:20 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"