Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 33
Default combined HLOOKUP (urgent for a friend)

Hi!

given the table

2007 2008 2008 2009 2012
10% 20% 40% 35% 10%

I want to calculate the sum of the values in row 2 for a certain year, e.g.
2008. How to do if a certain value is shown more than once?

e.g.
if given 2008,
result = 60%

HLOOKUP returns only one value (the same applies to the MATCH function)

any solution???


thanks!

tom
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 430
Default combined HLOOKUP (urgent for a friend)

How about using SUMIF?
=SUMIF(A1:E1,"=2008",A2:E2)
It will look at all the year cells and if they are =2008 then it will sum
them.


"tom ossieur" wrote:

Hi!

given the table

2007 2008 2008 2009 2012
10% 20% 40% 35% 10%

I want to calculate the sum of the values in row 2 for a certain year, e.g.
2008. How to do if a certain value is shown more than once?

e.g.
if given 2008,
result = 60%

HLOOKUP returns only one value (the same applies to the MATCH function)

any solution???


thanks!

tom

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
Default combined HLOOKUP (urgent for a friend)

Thanks for your reply, Tim.

I suppose I didn't express my question fully. Let me reword my question:

given the table

Sep-2007 Mar-2008 Sep-2008 Mar-2009
10% 20% 40% 35%

I want to calculate the sum of the values in row 2 for a certain year, e.g.
2008, and then put it in a separate table with heading only showing years,

2007 2008 2009
10% 60% 35%

Any function can solve this?

"tim m" wrote:

How about using SUMIF?
=SUMIF(A1:E1,"=2008",A2:E2)
It will look at all the year cells and if they are =2008 then it will sum
them.


"tom ossieur" wrote:

Hi!

given the table

2007 2008 2008 2009 2012
10% 20% 40% 35% 10%

I want to calculate the sum of the values in row 2 for a certain year, e.g.
2008. How to do if a certain value is shown more than once?

e.g.
if given 2008,
result = 60%

HLOOKUP returns only one value (the same applies to the MATCH function)

any solution???


thanks!

tom

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default combined HLOOKUP (urgent for a friend)


Assuming your first table in A1:D2 and second table in A4:C5 (i.e. years
in A4:C4)

formula in A5 copied across

=SUMPRODUCT(--(YEAR($A1:$D1)=A4),$A2:$D2)


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=566080

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
Default combined HLOOKUP (urgent for a friend)

thanks. what's the function of "--" I can't seem to locate it from the Excel
help file.

if I do not use "--", but instead using
SUMPRODUCT((YEAR($A$1:$D$1)=A4),$A2:$D2) directly, the result comes out as 0,
why?


"tom ossieur" wrote:

Hi!

given the table

2007 2008 2008 2009 2012
10% 20% 40% 35% 10%

I want to calculate the sum of the values in row 2 for a certain year, e.g.
2008. How to do if a certain value is shown more than once?

e.g.
if given 2008,
result = 60%

HLOOKUP returns only one value (the same applies to the MATCH function)

any solution???


thanks!

tom



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default combined HLOOKUP (urgent for a friend)


The sumproduct formula, as the name implies, multiplies arrays of
numbers and then sums the resultant array - but it needs to work with
numbers.

The (YEAR($A$1:$D$1)=A4) part of the formula produces an array of
TRUE/FALSE values, e.g. something like {TRUE,TRUE,FALSE,FALSE} so for
the formula to work as desired these need to be "co-erced" to 1/0
values. The -- (known as double unary minus) converts the above array
to {1,1,0,0}

There are other "co-ercers" that can be used, essentially any
mathematical operation that won't change the value, e.g. +0 or *1,
e.g.

=SUMPRODUCT((YEAR($A1:$D1)=A4)+0,$A2:$D2)

......or you can use a slightly different formulation....

=SUMPRODUCT((YEAR($A1:$D1)=A4)*($A2:$D2))


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=566080

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
Default combined HLOOKUP (urgent for a friend)

many thanks for your kind reply. It's very helpful to know the co-ercing
function :)

"daddylonglegs" wrote:


The sumproduct formula, as the name implies, multiplies arrays of
numbers and then sums the resultant array - but it needs to work with
numbers.

The (YEAR($A$1:$D$1)=A4) part of the formula produces an array of
TRUE/FALSE values, e.g. something like {TRUE,TRUE,FALSE,FALSE} so for
the formula to work as desired these need to be "co-erced" to 1/0
values. The -- (known as double unary minus) converts the above array
to {1,1,0,0}

There are other "co-ercers" that can be used, essentially any
mathematical operation that won't change the value, e.g. +0 or *1,
e.g.

=SUMPRODUCT((YEAR($A1:$D1)=A4)+0,$A2:$D2)

......or you can use a slightly different formulation....

=SUMPRODUCT((YEAR($A1:$D1)=A4)*($A2:$D2))


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=566080


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
Problem with HLookup - Sometimes works, sometimes blank. Regnab Excel Discussion (Misc queries) 3 May 22nd 06 04:09 AM
Hlookup, how di I get it to return more than one cell andyhofer Excel Worksheet Functions 1 March 30th 06 01:57 PM
Index / Hlookup Pamela Creighton Excel Worksheet Functions 1 February 5th 06 07:22 PM
Need help with HLOOKUP and MATCH functions BEAR94 Excel Worksheet Functions 1 August 12th 05 05:36 AM
Urgent Urgent Urgent!!! Ruslan Excel Discussion (Misc queries) 6 March 30th 05 02:59 PM


All times are GMT +1. The time now is 01:04 AM.

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

About Us

"It's about Microsoft Excel"