Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Returning Column Header

Hi all - I have the following columns and data
My Column headers are Item Code - Item Description and then Week
numbers for the year
The amount of sales for each item are scattered under the week number
- there are some empty cells and some cells contain 0
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Returning Column Header

On Feb 10, 11:06*pm, wrote:
Hi all - I have the following columns and data
My Column headers are Item Code - Item Description and then Week
numbers for the year
The amount of sales for each item are scattered under the week number
- there are some empty cells and some cells contain 0


Sorry - didn't finish - so what I want to do is enter a column before
the weeks start and in the column pull the column header (week number)
for the last cell in the row that is greater than 0 - so if for item
"A" the last sales (number greater than 0) is in column G I want to
return the value in row 1 of that column - which would be the week
number Thanks - Jake
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Returning Column Header

Try this:

Assume column headers are in the range B1:K1
Sales figures in the range B2:K2. There is only numbers or empty cells in
this range.

=IF(COUNTIF(B2:K2,"0"),LOOKUP(2,1/(B2:K20),B1:K1),"")

--
Biff
Microsoft Excel MVP


wrote in message
...
Hi all - I have the following columns and data
My Column headers are Item Code - Item Description and then Week
numbers for the year
The amount of sales for each item are scattered under the week number
- there are some empty cells and some cells contain 0



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Returning Column Header

On Feb 10, 11:53*pm, "T. Valko" wrote:
Try this:

Assume column headers are in the range B1:K1
Sales figures in the range B2:K2. There is only numbers or empty cells in
this range.

=IF(COUNTIF(B2:K2,"0"),LOOKUP(2,1/(B2:K20),B1:K1),"")

--
Biff
Microsoft Excel MVP

wrote in message

...



Hi all - I have the following columns and data
My Column headers are Item Code - Item Description and then Week
numbers for the year
The amount of sales for each item are scattered under the week number
- there are some empty cells and some cells contain 0- Hide quoted text -


- Show quoted text -


Biff - thanks so much - works perfectly. I'm trying to figure out how
it works - I read up on the Lookup function - the part I'm trying to
get is the 2,1/(B2:K20) part - why 2 and why 1 divided by the
reference. Thanks again - Jake
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Returning Column Header

Here's how it works:

LOOKUP takes these arguments:

LOOKUP(lookup_value,lookup_vector,result_vector)

In our formula the lookup_value is 2

The lookup_vector is 1/(B2:K20)

The result_vector is B1:K1

This means we want to find the value 2 in the lookup_vector and return the
corresponding value from the result_vector.

This portion of the lookup_vector:

(B2:K20)

Will return an array of either TRUE or FALSE.

Dividing those logical values by 1:

1/(B2:K20)

Will result in an array of either 1 or a #DIV/0! error

1/(TRUE) = 1
1/(FALSE) = #DIV/0!

The way that LOOKUP works is if the lookup_value is greater than all the
values in the lookup_vector it will match the *last* value in the
lookup_vector that is less than the lookup_value.

That's where the lookup_value of 2 comes into play. Since our lookup_vector
comprises an array of 1s and #DIV errors the *LAST* value that is less than
the lookup_value has to be a 1. So, the formula returns the header that
corresponds to the *last* 1 in the lookup_vector.

--
Biff
Microsoft Excel MVP


wrote in message
...
On Feb 10, 11:53 pm, "T. Valko" wrote:
Try this:

Assume column headers are in the range B1:K1
Sales figures in the range B2:K2. There is only numbers or empty cells in
this range.

=IF(COUNTIF(B2:K2,"0"),LOOKUP(2,1/(B2:K20),B1:K1),"")

--
Biff
Microsoft Excel MVP

wrote in message

...



Hi all - I have the following columns and data
My Column headers are Item Code - Item Description and then Week
numbers for the year
The amount of sales for each item are scattered under the week number
- there are some empty cells and some cells contain 0- Hide quoted
text -


- Show quoted text -


Biff - thanks so much - works perfectly. I'm trying to figure out how
it works - I read up on the Lookup function - the part I'm trying to
get is the 2,1/(B2:K20) part - why 2 and why 1 divided by the
reference. Thanks again - Jake


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
Get Intersection value given column header and row header Scorcel Excel Discussion (Misc queries) 1 June 6th 07 08:24 AM
Trouble returning to Normal view after inserting a header and foot Eazy-E Excel Worksheet Functions 0 July 26th 06 11:58 PM
Returning column header as result Patricia Excel Worksheet Functions 4 July 6th 06 05:36 PM
Excel - returning column headers in a seperate column ExcelConfused Excel Discussion (Misc queries) 1 March 28th 06 02:49 PM
returning header row as a result... mj Excel Worksheet Functions 17 March 6th 06 01:13 AM


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