Spliting cells in excel based on some parameter - excel-2007

I wanted to know who can the following content be split in to two cells:
if i have C:\Pgm\Win\a1.c
in one cell
how can i split it in to two cells
C:\Pgm\Win a1.c
In my excel I have around 500 such rows.Is their any key availabe to do. I am using excel 2007.

You can use formulas to do the split
Assuming first string is in cell A1, place these formulas
Cell B1
=LEFT(A1,FIND("*",SUBSTITUTE(A1,"\","*",LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))))-1)
Cell C1
=RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1,"\","*",LEN(A1)-LEN(SUBSTITUTE(A1,"\","")))))
Copy down for all data rows
Once these formulas are calculated, you can copy/paste values and delete the original data if required

by using data to columns ....we can get...in to multiple columns...but it will not be an 100% solution

Related

Copy and Paste to Blank Rows until Blank in Other Column

I am trying to copy and paste A8:P8 in to the Blank Rows (as per pic below) until the data in column Q is blank - is there a VBA which can do this? I need to do this on multiple tabs so the row number will be variable.
Although you could accomplish this with VBA, have you tried just using cell formulae?
For example, in the first empty cell in column A you'd put:
=$A$8
then the same for each other cell in the row, changing the column letter.
Then select all of the cells with formula and double-clicking the autofill handle which will copy the formula down to the last row with data in the adjacent column.

Excel formula into all cell array

Im trying to fill in a formula in a lot of cells using a VBA. The workbook I'm working with looks like this:
I'm trying to fill in a formula starting in B3. I first tried to define a range and insert formula, but my problem is that the range is never the same. Some data sets I have more columns and others i have more rows.
Is there a way to make a VBA that defines the range as all columns with content in Row1 and all rows with content in A?
The formula that I'm trying to inset is like this: =INDEX(Sheet1!$N:$N;MATCH(Sheet3!$A:$A&Sheet3!B$1;Sheet1!$R:$R;0))
I hope someone can help me with my problem.
you could create a dynamic named range that can be used in VBA
Use the below to define the range
=OFFSET(Sheet1!$B$3,0,0,COUNTA(Sheet1!$A:$A)-1,COUNTA(Sheet1!$1:$1)-1)
Changing Sheet1 to that of your sheetname
Assuming that there areno blank columns or rowsin your data set etc.

Excel Formula to VBA code Conversion

I am trying to create a macro that allows me to scan columns and rows of data and insert a formula into the blank cells. I am able to complete this task with the following excel formula:
=IF(ISBLANK(W4),((IFERROR(DATEDIF(MAX($P4,DATE(2016,5,1)),MIN($Q4,DATE(2016,8,1)),"d"),0)/(DATEDIF(P4,Q4,"d")))*$T4),W4)
My question is, is there a way I can put this into vba code so that I can run a macro that will automatically apply this formula in a column of my excel sheet across 30 rows? Therefore, the next row would read:
=IF(ISBLANK(W5),((IFERROR(DATEDIF(MAX($P5,DATE(2016,5,1)),MIN($Q5,DATE(2016,8,1)),"d"),0)/(DATEDIF(P5,Q5,"d")))*$T5),W5)
Thanks in advance for the help!
You can use
Range("RangeToCopyFormulaTo").Formula = Range("CellToCopyFormulaFrom").Formula
Excel will take care of updating the cell references, same as when you copy/paste

Pasting merged cells using VBA

I'm trying to copy a row of data from an excel sheet and transfer that to another sheet, but the range of row data has a two column merged cell in it and I'm having trouble pasting without any errors.
Any tips would be very helpful,
For copy a merged cells, you need mention range.
Example : A9 and B9 were merged, you need use Range("A9:B9").Copy to copy the merged cell

How to duplicate cell data in excel between rows if the cells are empty when another cell matches

I know the title is really long winded, I will try to explain
I am trying to get Magento products into Zen Cart (background only - shouldn't be relevant).
I have an excel 2010 xls spreadsheet and in it I have a load of product data: skus, prices, categories, etc... you get the idea. I have each of the products along with their data listed once, each with a unique SKU field.
But... Some of these products are in more than one category and the way I am importing, each product needs to be listed multiple times, once for each category.
So, I have done an sql dump which contains two columns; sku and category. I have pasted these values into excel as new rows, so now I have a situation like this (with a lot more entries):
As you can see for each sku (left highlight) there is one entry containing all the data apart from the category (right highlight) and then there is an additional entry for each category it belongs to which contains only the category and sku but none of the other data.
So, what I need to do is some how copy all the data (apart from the categories column) across all cells with the same sku. Does anyone have any idea how I can achieve this without hitting Ctrl+V several hundred times. I realise VBA can probably handle this pretty easily, but I dont have a clue on that front.
Any help greatly appreciated
I hope you’re willing to use a second sheet, and to reference the data rather than actually copying.
On Sheet2, set A1 to =IF(Sheet1!A1="", "", Sheet1!A1).  Drag (extend/fill) this down to A500 (as much data as you have on Sheet1, or further, to allow for growth).  Also drag A1 over to AA1 and then drag that down to AA500.
Then set B2 to =IF($AA2="", Sheet1!B2, B1), drag it to Z2, and drag B2:Z2 down to B500:Z500.
P.S. If any of your data (columns) are dates, you will probably need to explicitly format them as dates on Sheet2.  Ditto for any other values that are formatted any non-default way (e.g., Currency or Percentage).  It may be necessary to do this only to cells that have values in them (and not blank cells).
You don't need VBA, unless you need to do this many times.
Assuming the sheet with your data is called Source and the sheet with the result is called Dest, you can get what you want following these steps on the sheet Dest:
On A1 type =Source!A1
On A2 type =IF(ISBLANK(Source!A2),A1,Source!A2)
Select the range A1:XX1 (where XX is the last column of the sheet Source)
Press Ctrl+R (to copy the first cell to the right)
Select the range A2:XX## (where ## is the last row of the sheet Source)
Press Ctrl+R and Ctrl+D (to copy to the right and down)
Here is an explanation of what's going on:
The first row is copied from the Source as it is.
Each cell of the second row is copied from Source only if that cell is empty, otherwise the cell above is copied.
Here's the quick and dirty solution:
Select the columns you need to be filled
Press Goto Ctrl-G
Special `Alt-S'
Blanks (Alt-K, Enter)
This should select all blank cells. Now type =B2 (assuming you're in B3, i.e. use the cell above the active cell) Important: Press Ctrl-Enter instead of Enter to enter the formula.
Done!
On a new Worksheet get the numbers 1-26 running across the top in Row1 by typing 1 in cell A1, 2 in cell A2, and then selecting those two cells and filling through Z.
Now in A2 type the following formula =VLOOKUP(Sheet1!$A1,Sheet1!$A:$AA,VALUE(A$1),FALSE)
Fill this formula in the Range A2:Z## (where ## represents your last row of data).
Then copy Row1 from Sheet1 to Row1 on Sheet2.
This formula will copy the rows of data straight down into the empty rows below them (assuming the sku only changes where there is a row of new information.
This will then all be active formulas, so I would recommend selecting all on Sheet2 and right-clicking in cell A1, and paste special by value.