Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default IF statement on a range of cells in Excel 2007

Hi,

I'm trying to put up this formula:

=SUM(IF((G17:G31="Y"),($C17:$C31*80),0))

so that it multiplies with 80 and then sums all those values C17 through C31
for which values of G17 through G31 are Y.

But this gives me a value error in excel. When I remove the range and enter
a single cell, it works fine. I'm not sure what I'm doing wrong here.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default IF statement on a range of cells in Excel 2007

The formula as written is an array formula. You probably didn't enter it as
an array formula.

Array formulas are entered differently than a regular formula. After you
type in a regular formula you hit the ENTER key. With an array formula you
*must* use a combination of keys. Those keys are the CTRL key, the SHIFT key
and the ENTER key. That is, hold down both the CTRL key and the SHIFT key
then hit the ENTER key.

When done properly Excel will enclose the formulas in the brackets. You
can't just type these brackets in, you *must* use the key combo. Also,
anytime you edit an array formula it *must* be re-entered as an array using
the key combo.

You can write it like this:

=SUM(IF(G17:G31="Y",$C17:$C31*80))

However, you can also do this with a non-array formula (just hit ENTER):

=SUMIF(G17:G31,"Y",C17:C31)*80

--
Biff
Microsoft Excel MVP


"Harix" wrote in message
...
Hi,

I'm trying to put up this formula:

=SUM(IF((G17:G31="Y"),($C17:$C31*80),0))

so that it multiplies with 80 and then sums all those values C17 through
C31
for which values of G17 through G31 are Y.

But this gives me a value error in excel. When I remove the range and
enter
a single cell, it works fine. I'm not sure what I'm doing wrong here.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default IF statement on a range of cells in Excel 2007

Perhaps you forgot to enter it as an array formula?

Also, you can lose some of the parentheses.
=SUM(IF(G17:G31="Y",$C17:$C31*80,0)) as an array formula will do.
--
David Biddulph


Harix wrote:
Hi,

I'm trying to put up this formula:

=SUM(IF((G17:G31="Y"),($C17:$C31*80),0))

so that it multiplies with 80 and then sums all those values C17
through C31 for which values of G17 through G31 are Y.

But this gives me a value error in excel. When I remove the range and
enter a single cell, it works fine. I'm not sure what I'm doing wrong
here.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default IF statement on a range of cells in Excel 2007

Select the cell with that formula, click into the Formula Bar and then press
Ctrl+Shift+Enter (you have an array formula and it requires that keystroke
combination to commit it).

--
Rick (MVP - Excel)


"Harix" wrote in message
...
Hi,

I'm trying to put up this formula:

=SUM(IF((G17:G31="Y"),($C17:$C31*80),0))

so that it multiplies with 80 and then sums all those values C17 through
C31
for which values of G17 through G31 are Y.

But this gives me a value error in excel. When I remove the range and
enter
a single cell, it works fine. I'm not sure what I'm doing wrong here.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default IF statement on a range of cells in Excel 2007

Valko,

Thanks a bunch for the quick and detailed response! it worked! have a nice
day!

Haris

"T. Valko" wrote:

The formula as written is an array formula. You probably didn't enter it as
an array formula.

Array formulas are entered differently than a regular formula. After you
type in a regular formula you hit the ENTER key. With an array formula you
*must* use a combination of keys. Those keys are the CTRL key, the SHIFT key
and the ENTER key. That is, hold down both the CTRL key and the SHIFT key
then hit the ENTER key.

When done properly Excel will enclose the formulas in the brackets. You
can't just type these brackets in, you *must* use the key combo. Also,
anytime you edit an array formula it *must* be re-entered as an array using
the key combo.

You can write it like this:

=SUM(IF(G17:G31="Y",$C17:$C31*80))

However, you can also do this with a non-array formula (just hit ENTER):

=SUMIF(G17:G31,"Y",C17:C31)*80

--
Biff
Microsoft Excel MVP


"Harix" wrote in message
...
Hi,

I'm trying to put up this formula:

=SUM(IF((G17:G31="Y"),($C17:$C31*80),0))

so that it multiplies with 80 and then sums all those values C17 through
C31
for which values of G17 through G31 are Y.

But this gives me a value error in excel. When I remove the range and
enter
a single cell, it works fine. I'm not sure what I'm doing wrong here.






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default IF statement on a range of cells in Excel 2007

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Harix" wrote in message
...
Valko,

Thanks a bunch for the quick and detailed response! it worked! have a nice
day!

Haris

"T. Valko" wrote:

The formula as written is an array formula. You probably didn't enter it
as
an array formula.

Array formulas are entered differently than a regular formula. After you
type in a regular formula you hit the ENTER key. With an array formula
you
*must* use a combination of keys. Those keys are the CTRL key, the SHIFT
key
and the ENTER key. That is, hold down both the CTRL key and the SHIFT key
then hit the ENTER key.

When done properly Excel will enclose the formulas in the brackets. You
can't just type these brackets in, you *must* use the key combo. Also,
anytime you edit an array formula it *must* be re-entered as an array
using
the key combo.

You can write it like this:

=SUM(IF(G17:G31="Y",$C17:$C31*80))

However, you can also do this with a non-array formula (just hit ENTER):

=SUMIF(G17:G31,"Y",C17:C31)*80

--
Biff
Microsoft Excel MVP


"Harix" wrote in message
...
Hi,

I'm trying to put up this formula:

=SUM(IF((G17:G31="Y"),($C17:$C31*80),0))

so that it multiplies with 80 and then sums all those values C17
through
C31
for which values of G17 through G31 are Y.

But this gives me a value error in excel. When I remove the range and
enter
a single cell, it works fine. I'm not sure what I'm doing wrong here.






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
IF Statement for Cells in a Range Confused_in_Houston[_2_] Excel Discussion (Misc queries) 4 October 31st 08 03:56 PM
Excel 2007 crashes on entering data in a specific range of cells Sunny Dacat Excel Discussion (Misc queries) 1 September 12th 08 01:16 PM
Excel 2007 Filtering range [email protected] Excel Discussion (Misc queries) 1 June 4th 08 03:45 PM
Excel 2007 Range Selection CM Excel Discussion (Misc queries) 2 February 28th 08 10:17 PM
Using variables as first and last cells in range statement Tom from Ga Excel Worksheet Functions 2 February 6th 06 09:08 PM


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