Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Return value of heading if an adjacent cell in a row is not blank

I need some help/ideas in creating a macro or subroutine that returns the
column heading of the last cell in a row series that is not blank, and
populates the column heading in a cell adjacent to the last task date.

I'm using a worksheet to track the dates of when a particular task is
completed, and then I want to know what was the last task completed in this
series in the cell next to the last task on that row. The data looks like
this:


Task 1 Task 2 Task 3 Task 4 Task 5 Last Task
completed
4/1 4/5 4/6 4/8
Task 4
3/8 3/7
Task 2
3/15 3/17 3/18 3/22 3/29
Task 5
4/12 4/14 4/15
Task 3

....and so on.

What I'd like to do is have Excel check the row to see if it has a date
value and then go to the next cell until it finds one that is blank. If it
is blank, then return the column heading (task) of the last cell that was not
blank in the appropriate cell (in this case "Last Task Completed".

I'm using Excel 2000 and I'm comfortable using Excel, but beyond writing
simple macros and functions - I'm somewhat limited as I'm not familiar with
writing VBA code.

So any ideas or suggestions will be greatly appreciated!
--
Thanks, Wil H.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Return value of heading if an adjacent cell in a row is not blank

How about a formula that tries to match any impossible number on row 3 for
row 1.
=INDEX(1:1,1,MATCH(99999999999,3:3))

--
Don Guillett
SalesAid Software

"Wil H." wrote in message
...
I need some help/ideas in creating a macro or subroutine that returns the
column heading of the last cell in a row series that is not blank, and
populates the column heading in a cell adjacent to the last task date.

I'm using a worksheet to track the dates of when a particular task is
completed, and then I want to know what was the last task completed in

this
series in the cell next to the last task on that row. The data looks like
this:


Task 1 Task 2 Task 3 Task 4 Task 5 Last Task
completed
4/1 4/5 4/6 4/8
Task 4
3/8 3/7
Task 2
3/15 3/17 3/18 3/22 3/29
Task 5
4/12 4/14 4/15
Task 3

...and so on.

What I'd like to do is have Excel check the row to see if it has a date
value and then go to the next cell until it finds one that is blank. If

it
is blank, then return the column heading (task) of the last cell that was

not
blank in the appropriate cell (in this case "Last Task Completed".

I'm using Excel 2000 and I'm comfortable using Excel, but beyond writing
simple macros and functions - I'm somewhat limited as I'm not familiar

with
writing VBA code.

So any ideas or suggestions will be greatly appreciated!
--
Thanks, Wil H.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Return value of heading if an adjacent cell in a row is not blank

Suppose your data are laid out starting in cell A1. That means that
'Task 5' is in cell E1.

Now, if the tasks can be completed only in sequence (i.e., 1 must
precede 2, which must precede 3, etc.), then the formula, in F2,
=OFFSET($A$1,0,COUNTA(A2:E2)-1,1,1) gives you the desired result. Copy
F2 as far down column F as required.

Alternatively, if tasks can be completed in any sequence, use the array
formula =INDEX($A$1:$E$1,MAX(COLUMN(A2:E2)*(A2:E2<"")))

--
An array formula is entered with CTRL-SHIFT-ENTER rather than just
ENTER. If done correctly, XL will display curly brackets { and }
around the formula

Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I need some help/ideas in creating a macro or subroutine that returns the
column heading of the last cell in a row series that is not blank, and
populates the column heading in a cell adjacent to the last task date.

I'm using a worksheet to track the dates of when a particular task is
completed, and then I want to know what was the last task completed in this
series in the cell next to the last task on that row. The data looks like
this:


Task 1 Task 2 Task 3 Task 4 Task 5 Last Task
completed
4/1 4/5 4/6 4/8
Task 4
3/8 3/7
Task 2
3/15 3/17 3/18 3/22 3/29
Task 5
4/12 4/14 4/15
Task 3

...and so on.

What I'd like to do is have Excel check the row to see if it has a date
value and then go to the next cell until it finds one that is blank. If it
is blank, then return the column heading (task) of the last cell that was not
blank in the appropriate cell (in this case "Last Task Completed".

I'm using Excel 2000 and I'm comfortable using Excel, but beyond writing
simple macros and functions - I'm somewhat limited as I'm not familiar with
writing VBA code.

So any ideas or suggestions will be greatly appreciated!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Return value of heading if an adjacent cell in a row is not bl

Thank you for taking time to respond to my posting. Tushar's solution is the
one that produces the result that I'm looking for. Again, thank you for your
help.

"Tushar Mehta" wrote:

Suppose your data are laid out starting in cell A1. That means that
'Task 5' is in cell E1.

Now, if the tasks can be completed only in sequence (i.e., 1 must
precede 2, which must precede 3, etc.), then the formula, in F2,
=OFFSET($A$1,0,COUNTA(A2:E2)-1,1,1) gives you the desired result. Copy
F2 as far down column F as required.

Alternatively, if tasks can be completed in any sequence, use the array
formula =INDEX($A$1:$E$1,MAX(COLUMN(A2:E2)*(A2:E2<"")))

--
An array formula is entered with CTRL-SHIFT-ENTER rather than just
ENTER. If done correctly, XL will display curly brackets { and }
around the formula

Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I need some help/ideas in creating a macro or subroutine that returns the
column heading of the last cell in a row series that is not blank, and
populates the column heading in a cell adjacent to the last task date.

I'm using a worksheet to track the dates of when a particular task is
completed, and then I want to know what was the last task completed in this
series in the cell next to the last task on that row. The data looks like
this:


Task 1 Task 2 Task 3 Task 4 Task 5 Last Task
completed
4/1 4/5 4/6 4/8
Task 4
3/8 3/7
Task 2
3/15 3/17 3/18 3/22 3/29
Task 5
4/12 4/14 4/15
Task 3

...and so on.

What I'd like to do is have Excel check the row to see if it has a date
value and then go to the next cell until it finds one that is blank. If it
is blank, then return the column heading (task) of the last cell that was not
blank in the appropriate cell (in this case "Last Task Completed".

I'm using Excel 2000 and I'm comfortable using Excel, but beyond writing
simple macros and functions - I'm somewhat limited as I'm not familiar with
writing VBA code.

So any ideas or suggestions will be greatly appreciated!


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Return value of heading if an adjacent cell in a row is not bl

Testing shows that all three formulas produce the same result. Tushars could
even be
=OFFSET($A$1,0,COUNTA(3:3)-1,1,1)
=INDEX(1:1,MAX(COLUMN(3:3)*(3:3<""))) cse
--
Don Guillett
SalesAid Software

"Wil H." wrote in message
...
Thank you for taking time to respond to my posting. Tushar's solution is

the
one that produces the result that I'm looking for. Again, thank you for

your
help.

"Tushar Mehta" wrote:

Suppose your data are laid out starting in cell A1. That means that
'Task 5' is in cell E1.

Now, if the tasks can be completed only in sequence (i.e., 1 must
precede 2, which must precede 3, etc.), then the formula, in F2,
=OFFSET($A$1,0,COUNTA(A2:E2)-1,1,1) gives you the desired result. Copy
F2 as far down column F as required.

Alternatively, if tasks can be completed in any sequence, use the array
formula =INDEX($A$1:$E$1,MAX(COLUMN(A2:E2)*(A2:E2<"")))

--
An array formula is entered with CTRL-SHIFT-ENTER rather than just
ENTER. If done correctly, XL will display curly brackets { and }
around the formula

Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I need some help/ideas in creating a macro or subroutine that returns

the
column heading of the last cell in a row series that is not blank, and
populates the column heading in a cell adjacent to the last task date.

I'm using a worksheet to track the dates of when a particular task is
completed, and then I want to know what was the last task completed in

this
series in the cell next to the last task on that row. The data looks

like
this:


Task 1 Task 2 Task 3 Task 4 Task 5 Last

Task
completed
4/1 4/5 4/6 4/8
Task 4
3/8 3/7
Task 2
3/15 3/17 3/18 3/22 3/29
Task 5
4/12 4/14 4/15
Task 3

...and so on.

What I'd like to do is have Excel check the row to see if it has a

date
value and then go to the next cell until it finds one that is blank.

If it
is blank, then return the column heading (task) of the last cell that

was not
blank in the appropriate cell (in this case "Last Task Completed".

I'm using Excel 2000 and I'm comfortable using Excel, but beyond

writing
simple macros and functions - I'm somewhat limited as I'm not familiar

with
writing VBA code.

So any ideas or suggestions will be greatly appreciated!




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
How do I return the value of an adjacent cell? Kun0 Excel Discussion (Misc queries) 2 November 26th 08 05:03 PM
*HELP* Need a cell to return a column heading dan Excel Discussion (Misc queries) 4 August 15th 07 08:19 PM
Return value in adjacent cell TammyS Excel Worksheet Functions 5 August 30th 06 08:13 PM
return value in adjacent cell different workbook Don D Excel Worksheet Functions 4 May 2nd 06 11:37 PM
I want a non-blank cell to return 25% in an adjacent cell. mlatkovich Excel Programming 4 February 16th 05 02:09 AM


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