Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default If and then statement to sum corresponding prices.

Hi all,

I am trying to set up a worksheet that will calculate up how much
money I'm spending on people for thier christmas and birthdays this
year (unfortunately they all come at once!). The english version of
the formula I'm am trying to write is

IF B3:B32 = "David" AND D3:D32= "Birthday" THEN K4 = sum of
corresponding price in F3:F32.

I have to admit I'm not very good with If and then statements but I
understand the basics of programming.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default If and then statement to sum corresponding prices.

I should clarify that again me thinks after reading it back. If any of
the cells in B3:B32 = "David" and any of the cells in C4:C32
="Birthday" then I would like to add the price in the rows that are
true. I have also noticed that I should make it iterate through the
column instead of using the range and this will check the column all
at once, I think...

:S

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default If and then statement to sum corresponding prices.

IF is not the one to use. Use:
SUMPRODUCT(--(B3:B32="David"),--(D3:D32="Birthday"),F3,F32)
For more details see
http://www.xldynamic.com/source/xld.SUMPRODUCT.html
http://mcgimpsey.com/excel/formulae/doubleneg.html
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Doo0592" wrote in message
oups.com...
Hi all,

I am trying to set up a worksheet that will calculate up how much
money I'm spending on people for thier christmas and birthdays this
year (unfortunately they all come at once!). The english version of
the formula I'm am trying to write is

IF B3:B32 = "David" AND D3:D32= "Birthday" THEN K4 = sum of
corresponding price in F3:F32.

I have to admit I'm not very good with If and then statements but I
understand the basics of programming.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default If and then statement to sum corresponding prices.

Ctrl+Shift+Enter
=SUM(IF(B3:B32="David",IF(C3:C32="Birthday",F3:F32 )))

Doo0592 wrote:
I should clarify that again me thinks after reading it back. If any of
the cells in B3:B32 = "David" and any of the cells in C4:C32
="Birthday" then I would like to add the price in the rows that are
true. I have also noticed that I should make it iterate through the
column instead of using the range and this will check the column all
at once, I think...

:S


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default If and then statement to sum corresponding prices.

Bernard, sumproduct would certainly be more effecient than the array
formula I posted. I'm assuming that you meant to have a colon between
F3 and F32 instead of a comma.
=SUMPRODUCT(--(B3:B32="David"),--(C3:C32="Christmas"),F3:F32)

Regards,
-Jeff-

Bernard Liengme wrote:
IF is not the one to use. Use:
SUMPRODUCT(--(B3:B32="David"),--(D3:D32="Birthday"),F3,F32)
For more details see
http://www.xldynamic.com/source/xld.SUMPRODUCT.html
http://mcgimpsey.com/excel/formulae/doubleneg.html
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Doo0592" wrote in message
oups.com...
Hi all,

I am trying to set up a worksheet that will calculate up how much
money I'm spending on people for thier christmas and birthdays this
year (unfortunately they all come at once!). The english version of
the formula I'm am trying to write is

IF B3:B32 = "David" AND D3:D32= "Birthday" THEN K4 = sum of
corresponding price in F3:F32.

I have to admit I'm not very good with If and then statements but I
understand the basics of programming.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default If and then statement to sum corresponding prices.

Thanks guys, that worked but I found you only need one - before the
ranges to allow excel to work with the strings else it will return
£0.00 always. Was thinking about ignoring the returned zero values as
well but I can't remember how..

So far I have:

=if(k4=0,"") then sumproduct formula but I can't figure out what goes
inbetween as the "else". I thought it was a comma but it won't accept
it.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default If and then statement to sum corresponding prices.

On 11 Oct, 15:06, Doo0592 wrote:
Thanks guys, that worked but I found you only need one - before the
ranges to allow excel to work with the strings else it will return
£0.00 always. Was thinking about ignoring the returned zero values as
well but I can't remember how..

So far I have:

=if(k4=0,"") then sumproduct formula but I can't figure out what goes
inbetween as the "else". I thought it was a comma but it won't accept
it.


NM! I found a handy way to turn off the zero values in the options
menu under view. :)
Thanks again!

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
Can I round prices to end in .95? Tire Guy Excel Worksheet Functions 2 January 13th 09 10:47 PM
Looking up prices BEH1230 Excel Worksheet Functions 3 July 25th 07 08:42 PM
prices Manager that needs help Excel Discussion (Misc queries) 7 March 27th 06 05:30 PM
Look up a list of prices Numpty Excel Worksheet Functions 1 November 7th 05 12:56 AM
Use a multiplier to change List Prices to Net prices Dangada Excel Worksheet Functions 1 July 6th 05 06:31 AM


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