Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default how to sum a column using vb

i have two columns in excel the first column contains some cells with Y (for
yes) in them and N (for no) the second column contains a financial amount
i.e. £5.00 next to each letter (Y or N)

i want to create a cmd button which contains an 'if' statement to sum all
the financial cells where the cells next to it contains "Y"

i.e.

column 1 Column 2
y £5
y £5
n £5

sum = £10.00

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default how to sum a column using vb

Hi,

Use sumIf
SUMIF(range to evaluate,criteria,sum_range)

Application.WorksheetFunction.SumIf(Columns("A"), "Y", Columns("B"))

Regards

JY



"smason" wrote in message
...
i have two columns in excel the first column contains some cells with Y

(for
yes) in them and N (for no) the second column contains a financial amount
i.e. £5.00 next to each letter (Y or N)

i want to create a cmd button which contains an 'if' statement to sum all
the financial cells where the cells next to it contains "Y"

i.e.

column 1 Column 2
y £5
y £5
n £5

sum = £10.00



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
divide column(x) by column(y) to give column(x/y) in excel? James New Users to Excel 2 April 24th 23 11:46 AM
Referencing date column A & time column B to get info from column TVGuy29 Excel Discussion (Misc queries) 1 January 24th 08 09:50 PM
Return text in Column A if Column B and Column K match jeannie v Excel Worksheet Functions 4 December 13th 07 07:36 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look [email protected] Excel Discussion (Misc queries) 1 December 27th 06 05:47 PM
Divide Column A by Column B multiply Column C Stumped Excel Worksheet Functions 3 December 28th 05 05:51 AM


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