I have two excel sheets. The cells in the one sheet contains only simple numbers and strings. The other one has a lot of formatting and style. I want to move the data in sheet 1 to sheet 2 and have sheet 2 retain its format.
Essentially, if I write a number 1 in cell A1 in sheet 1, and color cell A1 in sheet 2 blue, I want to import the 1 from sheet 1 to sheet 2, and keep the colouring. I wish to do this for the whole sheet, matching cells and moving only the data.
Is this possible? I've tried using various things like saving the table format and the format painter but they do not produce the results I seek.
I'm not too sure which way you're trying to move data so i'll try and explain both:
If you want to copy the values from sheet 1 into sheet 2 exactly then try:
Paste Special - Values. You can do this easily with a keyboard shortcut of Ctrl+Alt+V and then pressing V and enter. More info Here
If you want to keep the data in sheet 1 but move formatting from sheet 2 across, then use:
Otherwise reading a bit more into Format Painter may be useful.
Microsoft has some instructions how to use this in detail Here. Otherwise there are some third party plugins such as Kutools that have more advanced features
Hope I've helped!
Related
I have multiple excel files that should "report" to a single one.
Imagine this example:
Excel 1)
Excel 1 is the one that receives the whole information from the other files. In that cell with the green circle, it should get the value which has row="6" and column="JAN" on other excel (Excel 2).
Excel 2)
In this excel there is a cell that has exactly the row="6" and column="JAN". The value does not match the cell number of each excel (in this example, the cell I want to fill in Excel 1 is E21 and in Excel 2 is E20).
Plus, I want this to be dynamic. If I now understand that the KPI I want to show in number 6 is another one I should change the number in Excel 2 and it should be getting that new value in Excel 1.
Was this clear? I'm sorry, English is not my primary language and I understand if it is a little bit confusing.
Thank you.
I was using the index function but that is not perfect for my case because if I change the KPI to another row it won't work anymore.
This seems to be a very basic question, but I have not found any answer on internet...
I have a table in a sheet 1 and want to bring that information to another table in sheet 2. But when I use the simple formulas =sheet1!B2, =sheet1!B3, =sheet1!B4, etc. to copy the cell in the new sheet, the autofit function doesn't work automatically as it does in the original cell. I have to do it manually... Any ides? Wrap text is already activated and format/autofit does not solve the problem.
Table 1 in sheet 1
Table 2 in sheet 2
I have an Excel file with three sheets, with data in each sheet organised in the same manner - headers are the same.
Without using VBA (as macros are not allowed by my organisation's security policy), I would like to find all rows from all sheets that meet a simple column value check and show those rows in a separate sheet.
For example:
Sheet2 has,
Sheet3 has,
Sheet4 has,
I want sheet1 to have all rows from sheets 2-4 with Header7 column value = "Hit",
What I have achieved so far is, using an array formula I could get all the "hits" from one sheet in sheet1.
The formula for A2 to A6 in sheet1 is as below, with the ROW(1:1) changing to ROW(2,2) and so on from A3 onwards. Columns B to G use the same formula with range adjusted accordingly.
{=IFERROR(INDEX(Sheet4!$A$2:$A$6,SMALL(IF(Sheet4!$G$2:$G$6="Hit",ROW(Sheet4!$A$2:$A$6)),ROW(1:1))-1,1),"")}
What this does is a bit complicated. In short, it creates an array of either FALSE or row numbers based on Hit and then finds the index of the non-false values.
Now, I can solve the last part of combining the idea to include all sheets in two ways (I think).
Have another temporary sheet (sheet5) with all rows from sheets 2 to 4. Update my formula in sheet1 to use sheet5 instead of 4.
Have the range Sheet4!A2:A6 etc changed to include a 3D reference like Sheet2:Sheet4!A2:A6. But this doesn't work, and the documentation for 3D reference doesn't mention that it works with array functions.
PS: I don't have Power Query, which seemed to have an easy way to create a new sheet with all rows from multiple sheets, because I work on a Mac (MS Excel for Mac).
I have a workbook in Excel 2010 with 2 worksheets.
Sheet 1 has rows of data sorted by dates with different numbers of rows for each date.
Sheet 2 calculates the daily averages based on the dates and puts them on individual rows,(1 row for each date) using formula =Sheet1!A5 which works fine but the row band color is copied too so Sheet 2 looks poorly formatted with regards to the row banding which seems to be inherited with reference.
How can I retain the uniform banding in sheet 2 and keep the fill color from being copied along with the cell's data?
If I understand Your question right: You dont want the cells to be colored in Sheet 2, but You want the values to be the same as in Sheet 1.
Judging by the pictures You have provided there is a Conditional formatting on Sheet 1. I think that You copied Sheet 2 from Sheet 1, using right click and Copy or move and the formatting was copied as well. On Sheet 2 under Conditional formatting delete or edit the current formatting rules. Make sure to select "This Table". That way You can see all the rules on Sheet 2, and its easier to delete or edit.
Formulas in Excel can't bring colors, so it has nothing to do with that.
I'm using NPOI.
I read in an Excel workbook with two sheets that acts as a "template" for the result workbook I'll be generating. Sheet 0 is empty aside from some header rows and sheet 1 has a number of rows of formulas. The formulas generally refer to the sheet 0 and pull data from it.
I can't write directly into the template workbook because I'd be having to move rows out of the way and it would get ugly fast, so in code I create a new result workbook with two sheets. Based on a preset configuration file, I populate the sheet 0 of this result workbook with data, row by row, cloning the style and formulas of certain rows from the template workbook. Sheet 0 ends up filled with data, and sheet 1 is basically a row of formulas copied and adjusted relatively, typically pulling data from sheet 0 with a small calculation here or there.
All of my data in sheet 0 is text and cannot be interpreted as numeric, dates, etc. So I set my data cell types as String.
In code I then loop through all cells in sheet 1 and EvaluateInCell.
I do this to obviously evaluate the formulas, but also to remove the formulas and leave the copied/calculated results. This is just a requirement of the work I'm doing. We deliver the end results and no formulas.
I save the resulting workbook.
In general things look good, except where I have cell formatting, the formatting seems to not be applied.
The formatting IS there when I get the cell formatting properties in Excel.
For example I might have text data that is a date-time in my data that shows up as:
7/7/2016 9:54:55 AM
this IS what the original data text is, but on my formula sheet I have a custom cell format yyyymmdd.
And yet, the cell still shows: 7/7/2016 9:54:55 AM
In Excel I then do something like manually edit the value, for example delete the last 'M' and retype 'M' and hit enter, that cell changes to the desired format and shows:
20160707
So again, the formatting IS there, it's just not applied.
I don't want to have to manually edit cells, or do anything once the workbook is opened in Excel by my customers. I want the resulting workbook to open up with the values formatted.
I've tried a few things that seemed like a shot in the dark, like:
this.ResultWorkbook.GetCreationHelper().CreateFormulaEvaluator().EvaluateAll();
((XSSFWorkbook)this.ResultWorkbook).SetForceFormulaRecalculation(true);
But this didn't help.
Any thoughts?
can you try either of this apprioach while setting the formula for cell
Approach 1
ICellStyle dateCellStyle = workbook.CreateCellStyle();
dateCellStyle.DataFormat = workbook.CreateDataFormat().GetFormat("yyyymmdd"); // Or prefix single quote for data when writing it to excel file like 'yyymmdd ex: '20160707
Approach 2
XSSFCellStyle dateCellStyle = (XSSFCellStyle)workbook.CreateCellStyle();
XSSFDataFormat dateDataFormat = (XSSFDataFormat)workbook.CreateDataFormat();
dateCellStyle.SetDataFormat(dateDataFormat.GetFormat("yyyymmdd"));
I ended up looking at the template Excel file's cell I'm writing into. It looks like if it's not DateUtil.IsCellDateFormatted and the cellStyle.DataFormat is not 0x31 (text based on BuiltInFormats), then it must be numeric.
Based on that I try to convert my text to DateTime or double as applicable, and call SetCellValue with those converted variables. Otherwise I write the text.
This seems to be working for cases I've encountered.