How to automate a spreadsheet - excel

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.

Related

Fill data in excel sheet from master list from another sheet

I have data in two separate excel sheet in single file.
In the first sheet, I have two columns...like this
Sheet1
In the second sheet, I have one of the column which is same as Name in Sheet1. However, it does not have second column where I want to bring the value referring to the sheet 1.
Here is the second sheet.
Here in second column, i.e. Color I want to bring the value from first sheet.
I am using Libreoffice but can use excel as well. Pls suggest how I would do this in excel / libreoffice.
Solution for Excel...
So use sheet one as the reference sheet. Sheet two as the one you want to fill.
In B2 on Sheet 2 enter this formula:
=vlookup(A2,Sheet1!$A$1:B$6$,2,FAlSE)
Then drag down.
This is assuming that your reference in sheet one is in columns A and B and goes from rows 1 to 6.
Hope this helps.
One of the easier ways to do this would be to use VLOOKUP. So this requires 4 inputs:
The value you are searching for
The array you are searching in
The column where the value you want to return is in
"FALSE" to list if you want an exact match between the value you are searching for and the array you are searching in.
So in your example, we will use the worksheet where you only have the Names listed as the worksheet you are putting the formula, so something like this in B2:
=VLOOKUP(A2,sheet2!$A$2:$B$6,2,FALSE)
So this would lookup the value you show in worksheet 1 cell A2.
Then go to workbook 2 and match that value with what is in A2:A6.
Then lookup what is in column 2 for your answer.
And return what is in column 2 only if worksheet 1 cell A2 and something in worksheet 2 range A2:A6 is an exact match.
There are other ways, but for your example, this should be easiest in EXCEL. This only works if the value you are searching for is to the right of the value you are looking up. If you need to go to the left, INDEX/MATCH would be better (but not required here).
Hope this helps!
JW

Excel: Narrow entries from a sheet to those that appear on another sheet

I'm a relatively novice Excel user trying to streamline the following task:
I've got two sheets of product information. Sheet1 has around 3000 entries and Sheet2 has around 1300 entries. Every SKU in the product number column on Sheet2 appears on Sheet1, but some are formatted differently: some cells in Sheet1's SKU column occasionally contain multiple comma-separated entries (Example: PDB2S2FW, PDB2S2V, PDB2S2WH), whereas all Sheet2 SKUs are listed in their own cells.
My goal is to identify the items on Sheet 1 that appear on Sheet2 (with a filter or a helper column) so that I can narrow down Sheet1 to include only the items on Sheet2.
I've been experimenting with a few formulas to attempt this task, but haven't been able to solve for the multiple entry/single cell issue.
Here's my current formula:
=IF(ISNA(MATCH(BJ9,Sheet2!B:B,0)),"Not found","Found")
[Column BJ on Sheet1 and Column B on Sheet2 hold product numbers.]
Any ideas? Thanks!
This answer uses an array formula. If you're new to Excel, you may not know how to do an array formula, so I'll add a quick tutorial and a link at the end of this answer:
This formula will give you a zero if there is not a match and a positive number if there is a match. Enter the formula in a column next to BJ on Sheet1, then drag fill to the bottom. You can then filter out all positive numbers and see those values which are not found on Sheet2.
Assumption: Values start in Row 1. If they don't, change $BJ1 to match the row where values start.
{=LARGE(IFERROR(FIND($BJ1,Sheet2!$B:$B),0),1)}
Note: It might be more efficient if you change Sheet2!$B:$B to reference only the cells that actually have data, instead of the entire column. For example: Sheet2!$B$1:$B:$3000.
Array Formulas
To enter the array formula,
Select and copy the above formula excluding the curly braces. The curly braces are there just to show that it is an array formula.
Paste the formula into a cell on your spreadsheet.
Press Ctrl + Shift + Enter
This page has more info about array formulas.
Caveat
The IFERROR function is only available in later versions of Excel. If you're using an older version, you may need to work with ISERR instead.

Excel table fill every third row

I need help with issue I'm having.
I got 2 sheets, 1st sheet is the table I need to fill and 2nd one is the data.
In the data part I have column A with employee number and B with names.
On the first sheet I have table that I need to fill but table is like this:
Blank row
Number column + Name column
Blank row
So when I just drag data to auto fill every third row formula skips employees and I only get every third name.
What can I do to fill every third row from 2nd sheet but without skipping names?
Kind of round about way that I have done it. On datasheet insert column a and put in values A1(1)A2(3)A3(5), Fill down this pattern this is to use as an index for filling the columns on your other sheet. On the sheet you are filling, insert a new column a and add 1,2,3 and fill down.
I used this vlookup:
=IFERROR(VLOOKUP(A1,datasheet!A:C,2,FALSE),"")
I copy this to column b and fill both of these columns down. Now you have your values. You will have to do a copy and paste values to get rid of the formulas once the info is in there. Select all, copy. and Ctrl+Alt+V and select values to do the paste special.
Hope this helps.

Creating 'duplicate' cells in other Excel (2010) Sheets including formatting

Just hoping someone can help - I've been experimenting and googling for ages with no success!
On Excel 2010, I would like to copy a range of cells from one sheet (say, Sheet 1) to another in the same workbook. I need the copy to have the contents of the cells AND their formatting AND to mirror any changes which happen to either the contents or formatting of those cells in Sheet 1.
Is there any way I can do this please? Please note, I'm not familiar with using VBA so if that's needed I'll need some instructions about how to use/copy any code solutions you give me into my workbook too?
if you select both sheets (press CTRL while selecting sheet tabs) everything you do on sheet1 is replicated on sheet2
so select both sheets
select a cell or range of cells
format and enter content as desired
untie sheets (press CTRL while selecting sheet tabs)
sheet2 is a duplicate of sheet 1
hope that helps
To duplicate cells on Sheet 1 on Sheet 2, even when entering new rows on sheet 1
Enter ROW() in every row of column "A" in sheet one. This duplicates the row number to be used for your vlookup.
On Sheet 2 for every cell you wish to duplicate:
=IFERROR(VLOOKUP(ROW(),'Sheet 1'!$A:$G,COLUMN()+1,FALSE),"")
When entering a new row on Sheet 1, you will need to copy the ROW() function to the first column of the new row.
All other adjustments are automatic except adding columns. Adding columns requires additional steps.

VLOOKUP & Inserting Text That Corresponds To The Cell

I'm having difficulty getting my vlookup formula to pull url data from another sheet (Sheet 2) and insert added information to the url based on what is in its A cell on Sheet 1.
For example,
The vlookup formula =VLOOKUP(B2,Sheet2!A:B,2,FALSE) will check to see if B2 (Sheet 1) matches with Data on Sheet 2. It will then return the data it has matched:
=HYPERLINK("http://www.dpd.co.uk/tracking/quicktrack.do?search.consignmentNumber="&Sheet1!A2&"&search.searchType=16&search.javascriptValidated=0&appmode=guest")
I then want the url link to insert whatever text is in the Sheet 1 A cell.
The formula I have used does this nicely, but I want the formula to correspond down the workbook for whatever is in cell A, not just A1 i.e. Sheet 1 A3,Sheet 1 A4....
How can I do this?
Thanks
I'm not sure if I completely understand what you are asking but allow me to share my experience with what I believe was a similar problem.
My solution was an offset/match formula. I used a formula similar to:
=OFFSET($A$1,(MATCH(B$2,'Sheet2'!$A:$B,0)+$A1),0)
And had a list of values in column A that corresponded to the distance that row was to the object cell I wanted to keep constant. Then I used autofill to fill column a down the sheet as far as I filled the formula. This way offset refrence changed on each row and I was still able to auto fill.
I hope that helps

Resources