Number rows in Column A based on values in Column B - excel

Here's what I'm trying to do using Excel 2010 VBA:
I have a list of course names in column B. Each time the course name changes I've inserted two blank rows. What I need to do is number the rows in column A, stop numbering when I hit a blank row and then restart the numbering when I get a new course name in column B. Any assistance is greatly appreciated.

Easier than VBA. Put this formula in A2, and copy down
=IF(ISBLANK(B2),"",MAX(A$1:A1)+1)

Related

Excel VBA: How to sum values in column until value in another column changes?

I am trying to figure out how I can sum the data in column D until the value in column A changes, and place the result in B. Also, the sum result should only be in rows where there is text in column A. I put an example image of my set-up. I would like to use VBA as some spreadsheets I have in this format have hundreds of line items.
I imagine I can use VBA to get the row number of the next non blank cell in column A, but I can't quite figure out the code.
Any help is appreciated! Thank you!

Populate Data from a column and populate every 4th cell with data in sequence

I am trying to take data from a column "C4:C2048" and populate the first and every 4th cell in the adjacent column "D:D" with the values in the order they are in from column C.
I've tried variants on =IF(MOD(CELL("row",C5),5)=0,C5,"") but could not get it to be a draggable formula (so I do not have to spend weeks writing specific formula to get down to row 2048 or beyond (!!). These serials will be scanned onto the excel workbook with a barcode scanner, and "return" will be pressed to populate column C with the row of serial numbers.
Can anyone help me out please??
Update 1:
Here is an example of what I need:
example output
The data in column C is barcode scanned in, needs to output with the spacing in column D (every 4 rows). Thanks again!
This, assuming set up as in screenshot?
=INDEX(C:C,ROW()*4)
=IF(MOD(ROW(a1);4)=0;C1;"")
In column D that formula will give you what you asked for
Assuming your data starts in Row 1. If it starts in a different row. replace A1 and C1 respectively in the formula with the row number you start with.

Excel VBA OR Formula

I am wanting to set up a macro or formula to automatically remove duplicates in a column. Column c is where the data is inputted, this then populates in column a but column A needs to contain none of the duplicates. My column B is checking A against C to see how many times A criteria's appear in B and this all feeds through to my front end sheet.
So like i say, A needs to populate with C data but remove duplicates in A at the same time.
Many thanks for any help

Copy paste line items in Sheet B to filtered rows in Sheet A in Excel?

I have Sheet A with 500 line items.
Suppose I have applied filter to show line items "2","44","68" and so on
From Another Sheet i want to select some rows and paste them in these filtered rows.If I paste,they get copied on line items 2,3,4,5, and so one instead of 2,44,68,etc
Can Someone please help me.I tried paste special,but it has same issue.
I also tried selecting the area to paste,then clicking alt + ; but the data also gets copied into unfiltered items.
This is more of an approach solution then a coding solution. I assume that the current order of the rows must be maintained.
Add a column to to your sheet, use autocomplete to number the current order of the rows.
Sort by your filter value(s) - if you have multiple values, just add another column and put a single unique value in it
Paste your values
Sort by you current order column, to restore the orginal order
If it is with same sheet you can make the two columns adjacent by hiding other columns in between. You can block the data and drag it to next column.
For eg.
I have column A, B, C, D.
Let A be ZIP CODE & Column D is 'Shipping Service'
I need to have ZIP CODE(Column A) with '95035' to have Shipping Service as 'Fedex'
Filter the column A with '95035'
Hide the column B & C
Drag the values from A to D directly where the values are copied to the adjacent cells.
Note: If you use two separate sheets copy the columns entirely to the sheet 1 adjacent to the column you want to copy and again take copy the entire column back to Sheet 2. This will work if both sheet have same number of rows.
Thanks,
Karthik
The easiest coding solution is to use vlookup http://office.microsoft.com/en-us/excel-help/vlookup-HP005209335.aspx
On sheet1 from Sheet2 use
=VLOOKUP(B3,Sheet2!A:B,2,FALSE)

How to automate a spreadsheet

I am using microsoft excel 2002. What I am wanting to do is say I have some data in column A in sheet 1 and data in column A in sheet 2.
What I want to do is when I add data to sheet 1 Column A (lets say some text), I want excel to automatically add a row in sheet 2 column A. So if I have 30 rows in both sheets and I add a string "hello" in sheet 1 Column A (in row 31), I want it to automatically add the same row in sheet 2 Column A (row 31).
Is this possible to do from within excel?
Thanks in advance for your help.
In column Sheet 2 , column A row 1
enter the formula '='Sheet 1'!A1
Then cntrl C the cell with the formula you just entered,
Still in Sheet 2 select cells A2 to A99 or however many columns you expect to enter
cntrl V
The values you enter in Sheet1 will magically appear in sheet2
You can do this easy in VBA. If getting started is hard for you, record a macro and check out the generated code. You'll have no problem continuing from there.
Good luck!
you could put an Array formula in Sheet2 Column A. I dont think you can get this to work on the entire column, but you could apply it to say the first 5000 rows. Then when the user enters values on Sheet1 they would be duplicated on Sheet2.
Somthing like:
=IF(Sheet1!$A$1:$A$5000="","",Sheet1!$A$1:$A$5000)
Should copy the cells from A1:A5000 and remove the empty ones into the destination range. You will need to select the 5000 cells on Sheet2 and enter the formula and then press Ctrl-Enter to insert it as an array formula.
This is far simpler than attempting to build something either with VBA or VSTO to watch for changes and duplicate them.

Resources