Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
find percentage | New Users to Excel | |||
Find percentage ??? | Excel Worksheet Functions | |||
Find percentage ??? | Excel Worksheet Functions | |||
How do I find a percentage? | Excel Discussion (Misc queries) | |||
Find blank cells and calculate sums | Excel Programming |