A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Which function will shorten IF-THEN-ELSE ?



 
 
Thread Tools Display Modes
  #1  
Old May 18th, 2010, 10:02 AM posted to microsoft.public.excel.worksheet.functions
Jack Ryan[_2_]
external usenet poster
 
Posts: 2
Default Which function will shorten IF-THEN-ELSE ?

Here's a simplified example of what I want to do:

Col A Col B
Row 1 yes 5
Row 2 10
Row 3 yes 15
Row 4 yes 20

What is the formula that will automatically find all numbers in Col B
that have a corresponding "yes" in Col A, then SUM them and multiply
by 30% ? If done manually, the final result would then be the
equivalent of =(5+15+20)*.30, which is 12.

Thanks,


  #2  
Old May 18th, 2010, 10:21 AM posted to microsoft.public.excel.worksheet.functions
Jack R[_3_]
external usenet poster
 
Posts: 2
Default Which function will shorten IF-THEN-ELSE ?

On May 18, 2:02*am, Jack Ryan wrote:
Here's a simplified example of what I want to do:

* * * * * * *Col A * * *Col B
Row 1 * * yes * * * * * 5
Row 2 * * * * * * * * * *10
Row 3 * * yes * * * * 15
Row 4 * * yes * * * * 20

What is the formula that will automatically find all numbers in Col B
that have a corresponding "yes" in Col A, then SUM them and multiply
by 30% ? *If done manually, the final result would then be the
equivalent of =(5+15+20)*.30, which is 12.

Thanks,


Is this formula the best correct answer?
=SUMIF(A1:A4,"yes",B1:B4)*0.3
Could a LOOKUP or OFFSET function be used to achieve the same answer?

Thanks,

  #3  
Old May 18th, 2010, 10:51 AM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default Which function will shorten IF-THEN-ELSE ?

Hi,

Use this

=SUMPRODUCT((A1:A10="Yes")*(B1:B10))*0.3
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Jack Ryan" wrote:

Here's a simplified example of what I want to do:

Col A Col B
Row 1 yes 5
Row 2 10
Row 3 yes 15
Row 4 yes 20

What is the formula that will automatically find all numbers in Col B
that have a corresponding "yes" in Col A, then SUM them and multiply
by 30% ? If done manually, the final result would then be the
equivalent of =(5+15+20)*.30, which is 12.

Thanks,


.

  #4  
Old May 18th, 2010, 10:58 AM posted to microsoft.public.excel.worksheet.functions
Roger Govier[_8_]
external usenet poster
 
Posts: 338
Default Which function will shorten IF-THEN-ELSE ?

Hi Jack

An alternative would be
=SUMPRODUCT((A1:A4="yes")*B1:B4)*0.3

Your formula is fine, and SUMIF is far more efficient than Sumproduct,
so on a large amount of data I would expect it to be considerably faster.
--
Regards
Roger Govier

Jack R wrote:
On May 18, 2:02 am, Jack Ryan wrote:
Here's a simplified example of what I want to do:

Col A Col B
Row 1 yes 5
Row 2 10
Row 3 yes 15
Row 4 yes 20

What is the formula that will automatically find all numbers in Col B
that have a corresponding "yes" in Col A, then SUM them and multiply
by 30% ? If done manually, the final result would then be the
equivalent of =(5+15+20)*.30, which is 12.

Thanks,


Is this formula the best correct answer?
=SUMIF(A1:A4,"yes",B1:B4)*0.3
Could a LOOKUP or OFFSET function be used to achieve the same answer?

Thanks,

  #5  
Old May 18th, 2010, 04:33 PM posted to microsoft.public.excel.worksheet.functions
Jack R[_3_]
external usenet poster
 
Posts: 2
Default Which function will shorten IF-THEN-ELSE ?

On May 18, 2:58*am, Roger Govier
wrote:
Hi Jack

An alternative would be
=SUMPRODUCT((A1:A4="yes")*B1:B4)*0.3

Your formula is fine, and SUMIF is far more efficient than Sumproduct,
so on a large amount of data I would expect it to be considerably faster.
--
Regards
Roger Govier

Jack R wrote:
On May 18, 2:02 am, Jack Ryan wrote:
Here's a simplified example of what I want to do:


* * * * * * *Col A * * *Col B
Row 1 * * yes * * * * * 5
Row 2 * * * * * * * * * *10
Row 3 * * yes * * * * 15
Row 4 * * yes * * * * 20


What is the formula that will automatically find all numbers in Col B
that have a corresponding "yes" in Col A, then SUM them and multiply
by 30% ? *If done manually, the final result would then be the
equivalent of =(5+15+20)*.30, which is 12.


Thanks,


Is this formula the best correct answer?
=SUMIF(A1:A4,"yes",B1:B4)*0.3
Could a LOOKUP or OFFSET function be used to achieve the same answer?


Thanks,


I was just wondering how LOOKUP and OFFSET could be helpful in a
larger version of my example. What would my example look like for
LOOKUP and OFFSET to be useful?

  #6  
Old May 19th, 2010, 09:03 PM posted to microsoft.public.excel.worksheet.functions
Roger Govier[_8_]
external usenet poster
 
Posts: 338
Default Which function will shorten IF-THEN-ELSE ?

Hi Jack

Offset is a volatile function, and on a large spreadsheet is to be
avoided wherever possible. It creates a huge overload in processing and
will slow the sheet down enormously.

Sumif is one of the most efficient functions, and your proposed solution
is the best - IMHO
--
Regards
Roger Govier

Jack R wrote:
On May 18, 2:58 am, Roger Govier
wrote:
Hi Jack

An alternative would be
=SUMPRODUCT((A1:A4="yes")*B1:B4)*0.3

Your formula is fine, and SUMIF is far more efficient than Sumproduct,
so on a large amount of data I would expect it to be considerably faster.
--
Regards
Roger Govier

Jack R wrote:
On May 18, 2:02 am, Jack Ryan wrote:
Here's a simplified example of what I want to do:
Col A Col B
Row 1 yes 5
Row 2 10
Row 3 yes 15
Row 4 yes 20
What is the formula that will automatically find all numbers in Col B
that have a corresponding "yes" in Col A, then SUM them and multiply
by 30% ? If done manually, the final result would then be the
equivalent of =(5+15+20)*.30, which is 12.
Thanks,
Is this formula the best correct answer?
=SUMIF(A1:A4,"yes",B1:B4)*0.3
Could a LOOKUP or OFFSET function be used to achieve the same answer?
Thanks,


I was just wondering how LOOKUP and OFFSET could be helpful in a
larger version of my example. What would my example look like for
LOOKUP and OFFSET to be useful?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:50 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.