Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Find percentage of sums

Now that I have this code, there is one last step which I don't know how to
write. If I record, it will be based on specific cells, which I never know
where the end will be. WIth that said, I used the following code provided
earlier that works great, but I need to now take the result of these two
numbers to figure a percent. Specifically =sum(b?-c?)/c?


Dim LastRow As Long
LastRow = Cells(Cells.Rows.Count, 1).End(xlUp).Row
Cells(LastRow + 1, 2).Formula = "=sum(b1:b" & LastRow & ")"

LastRow = Cells(Cells.Rows.Count, 1).End(xlUp).Row
Cells(LastRow + 1, 3).Formula = "=sum(c1:c" & LastRow & ")"


How can I write take the last number in columnl b minus last row in column
c divided by last row in column c? The result will be listed in the last
row of column D.

Thanks much!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Find percentage of sums

If you want the percentage of the difference between the sums to the sum of
C then:

x = Range("B" & LastRow).Value
y = Range("C" & LastRow).Value

Range("D" & LastRow) = (x-y)/y

If you want the percentage of the difference between the sums to the sum of
B then:

x = Range("B" & LastRow).Value
y = Range("C" & LastRow).Value

Range("D" & LastRow) = (x-y)/x





"Annette" wrote in message
...
Now that I have this code, there is one last step which I don't know how
to write. If I record, it will be based on specific cells, which I never
know where the end will be. WIth that said, I used the following code
provided earlier that works great, but I need to now take the result of
these two numbers to figure a percent. Specifically =sum(b?-c?)/c?


Dim LastRow As Long
LastRow = Cells(Cells.Rows.Count, 1).End(xlUp).Row
Cells(LastRow + 1, 2).Formula = "=sum(b1:b" & LastRow & ")"

LastRow = Cells(Cells.Rows.Count, 1).End(xlUp).Row
Cells(LastRow + 1, 3).Formula = "=sum(c1:c" & LastRow & ")"


How can I write take the last number in columnl b minus last row in
column c divided by last row in column c? The result will be listed in
the last row of column D.

Thanks much!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Find percentage of sums

You probably will have to change all the "LastRow" references to "LastRow +
1" without the quote marks, of course.



"Annette" wrote in message
...
Now that I have this code, there is one last step which I don't know how
to write. If I record, it will be based on specific cells, which I never
know where the end will be. WIth that said, I used the following code
provided earlier that works great, but I need to now take the result of
these two numbers to figure a percent. Specifically =sum(b?-c?)/c?


Dim LastRow As Long
LastRow = Cells(Cells.Rows.Count, 1).End(xlUp).Row
Cells(LastRow + 1, 2).Formula = "=sum(b1:b" & LastRow & ")"

LastRow = Cells(Cells.Rows.Count, 1).End(xlUp).Row
Cells(LastRow + 1, 3).Formula = "=sum(c1:c" & LastRow & ")"


How can I write take the last number in columnl b minus last row in
column c divided by last row in column c? The result will be listed in
the last row of column D.

Thanks much!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Find percentage of sums

This worked great ... thanks much
"JLGWhiz" wrote in message
...
You probably will have to change all the "LastRow" references to "LastRow
+ 1" without the quote marks, of course.



"Annette" wrote in message
...
Now that I have this code, there is one last step which I don't know how
to write. If I record, it will be based on specific cells, which I never
know where the end will be. WIth that said, I used the following code
provided earlier that works great, but I need to now take the result of
these two numbers to figure a percent. Specifically =sum(b?-c?)/c?


Dim LastRow As Long
LastRow = Cells(Cells.Rows.Count, 1).End(xlUp).Row
Cells(LastRow + 1, 2).Formula = "=sum(b1:b" & LastRow & ")"

LastRow = Cells(Cells.Rows.Count, 1).End(xlUp).Row
Cells(LastRow + 1, 3).Formula = "=sum(c1:c" & LastRow & ")"


How can I write take the last number in columnl b minus last row in
column c divided by last row in column c? The result will be listed in
the last row of column D.

Thanks much!





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
find percentage israel New Users to Excel 4 April 1st 23 09:45 PM
Find percentage ??? Bernard Liengme Excel Worksheet Functions 1 December 12th 05 04:40 AM
Find percentage ??? [email protected] Excel Worksheet Functions 0 December 10th 05 07:50 PM
How do I find a percentage? PBarton Excel Discussion (Misc queries) 2 November 27th 05 10:40 PM
Find blank cells and calculate sums AlisonB Excel Programming 5 December 2nd 03 05:15 PM


All times are GMT +1. The time now is 04:44 PM.

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"