VBA help. Column A divide Column B and put answer in Column C for every row.

bessieunl

New Member
Joined
May 19, 2015
Messages
11
Hi, im new to vba and I need some help with my work.
In my worksheet, sheet1, I have 388 rows of data, for each row, I want to be able to make values in Column A divide by Values in Column B, and put this answer to column c. and it keeps going till the last column. (so after the 1st round of calculation, it goes to column D, column D divide by Colum E, put values in F. )

Help is greatly appreciated !
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
bessieunl,

1. What version of Excel, and, Windows are you using?

2. Are you using a PC or a Mac?


To start off, and, so that we can get it right on the first try:

Can you post a screenshot of the actual raw data worksheet (say 10 rows, and, 6 columns) ?

And, can you post a screenshot of the worksheet results (manually formatted by you) that you are looking for?

To post a small screen shot (NOT a graphic, or, picture, or, flat text) try one of the following:

MrExcel HTML Maker
If you do not know how to install and how to use HTML Mr.Excel Maker
https://www.youtube.com/watch?v=JycvgGppxt0&feature=youtu.be

Excel Jeanie
Download

Borders-Copy-Paste
http://www.mrexcel.com/forum/about-board/444901-how-create-table-like-aladin.html#post2198045

To test the above:
Test Here


Or, you can upload your workbook to (the BLUE link-->) Box Net ,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.
 
Last edited:
Upvote 0
hi, im using a pc, and excel 2010.
Column A B C D E F ...........................FN FO FP
ROW2 55 74
ROW3
ROW4 1 1


this is how my worksheet looks like, For each row, I want to be able to divide values in Column A by Values in Column B, and put this answer to column C. I would like to keep up this pattern going until the last column (FP). So after the 1st round of calculation, it goes to column D, column D gets divided by column E, and values go into column F.
also, since some of my cell contains no value, excel cant divide empty cells to empty cells. so I am hoping that the code can do the calculation for cells that have value and skip ones are empty.
I want to be able to apply it to every row until the last row (388) and every column until the last column (FP, = FN/FO)
 
Upvote 0
bessieunl,

1. What version of Excel, and, Windows are you using?

2. Are you using a PC or a Mac?


To start off, and, so that we can get it right on the first try:

Can you post a screenshot of the actual raw data worksheet (say 10 rows, and, 6 columns) ?

And, can you post a screenshot of the worksheet results (manually formatted by you) that you are looking for?

To post a small screen shot (NOT a graphic, or, picture, or, flat text) try one of the following:

MrExcel HTML Maker
If you do not know how to install and how to use HTML Mr.Excel Maker
https://www.youtube.com/watch?v=JycvgGppxt0&feature=youtu.be

Excel Jeanie
Download

Borders-Copy-Paste
http://www.mrexcel.com/forum/about-board/444901-how-create-table-like-aladin.html#post2198045

To test the above:
Test Here


Or, you can upload your workbook to (the BLUE link-->) Box Net ,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.

hi, im using a pc, and excel 2010.
Column A B C D E F ...........................FN FO FP
ROW2 55 74
ROW3
ROW4 1 1


this is how my worksheet looks like, For each row, I want to be able to divide values in Column A by Values in Column B, and put this answer to column C. I would like to keep up this pattern going until the last column (FP). So after the 1st round of calculation, it goes to column D, column D gets divided by column E, and values go into column F.
also, since some of my cell contains no value, excel cant divide empty cells to empty cells. so I am hoping that the code can do the calculation for cells that have value and skip ones are empty.
I want to be able to apply it to every row until the last row (388) and every column until the last column (FP, = FN/FO)
 
Upvote 0
bessieunl,

1. What version of Excel, and, Windows are you using?

2. Are you using a PC or a Mac?


To start off, and, so that we can get it right on the first try:

Can you post a screenshot of the actual raw data worksheet (say 10 rows, and, 6 columns) ?

And, can you post a screenshot of the worksheet results (manually formatted by you) that you are looking for?

To post a small screen shot (NOT a graphic, or, picture, or, flat text) try one of the following:

MrExcel HTML Maker
If you do not know how to install and how to use HTML Mr.Excel Maker
https://www.youtube.com/watch?v=JycvgGppxt0&feature=youtu.be

Excel Jeanie
Download

Borders-Copy-Paste
http://www.mrexcel.com/forum/about-board/444901-how-create-table-like-aladin.html#post2198045

To test the above:
Test Here


Or, you can upload your workbook to (the BLUE link-->) Box Net ,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.

This is what I have now, and it just stops when it hits the first empty cell and tells me that I have a mismatch error

Sub Percent()
Condition = True
xrowx = 3
xcolx = 4

Do While Condition = True
With Sheets("Sheet1")
tempA = CDbl(.Cells(xrowx, xcolx - 2).Value)
tempB = CDbl(.Cells(xrowx, xcolx - 1).Value)
.Cells(xrowx, xcolx) = tempA / tempB

xrowx = xrowx + 1
If xrowx > WorksheetFunction.CountA(.Range(.Cells(1, xcolx - 1), .Cells(xrowx, xcolx - 1))) Then
xrowx = 3
xcolx = xcolx + 3
If xrowx >= 389 And xcolx >= 172 Then
Exit Do
End If
End If
End With
Loop

End Sub
 
Upvote 0
bessieunl,

Unless there is a particular reason to do so, it is best not to quote whole long replies like you did with mine. It makes the thread harder to navigate/read and just takes up unnecessary space.

1. Quote ONLY if it is needed to add clarity or context for your reply. If so, then
2. Quote ONLY the specific part of the post that is relevant - - not the entire post.

This will keep thread clutter to a minimum and make the discussion easier to follow.


When posting VBA code, please use Code Tags - like this:

[code=rich]

'Paste your code here.

[/code]


I can not tell where your raw data is located, sheet name, cells, rows, columns, and, I can not tell where the results should be, sheet name, cells, rows, columns.

To start off, and, so that we can get it right on the first try:

Can you post a screenshot of the actual raw data worksheet?

And, can you post a screenshot of the worksheet results (manually formatted by you) that you are looking for?

To post a small screen shot (NOT a graphic, or, picture, or, flat text) try one of the following:

MrExcel HTML Maker
If you do not know how to install and how to use HTML Mr.Excel Maker
https://www.youtube.com/watch?v=JycvgGppxt0&feature=youtu.be

Excel Jeanie
Download

Borders-Copy-Paste
http://www.mrexcel.com/forum/about-board/444901-how-create-table-like-aladin.html#post2198045

To test the above:
Test Here


Or, you can upload your workbook to (the BLUE link-->) Box Net ,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.



If you are not able to provide screenshots, or, your workbook (per the above), then:

Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,669
Members
448,977
Latest member
moonlight6

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top