Conditional Formatting Colorindex Error In Pivot Table
May 24, 2007
Below is some code I am trying to run. What I would like to do is select a certain "data row" in the pivot, and apply some conditional formatting to that. It works just fine until I reach the .colorindex = 3 line. It says I'm getting an application/object defined. how to fix this? I'm on Excel 2007. This was fine on 2000!
pvtCurrent.PivotSelect "'% Dist'", xlDataAndLabel
With Selection
With .Interior
.ColorIndex = 36
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
With .FormatConditions.Add(xlCellValue, xlBetween, "0", "0.97")
With .Font
.Bold = True
.ColorIndex = 3
End With
End With
End With
writing VB code to conditionally-format the pivot table shown here (I am not inclined to use the Excel Conditional formatting option as it loses the formatting when refreshing the pivot table)
Excel_screenshot1.png
I need a VB macro that reads each value in a Pivot table .. starting with the Col1, Row1 of the Pivot table .
It then matches the value in Col 1, Row1 to the Baseline value for Col 1 that is specified in (Yellow ) .
Note : The Baseline values are not part of the Pivot table area
If the value in in the Col 1, Row1 is less than the baseline value for that column at the top ,it formats the font color of that pivot table cell (say to red) It then moves to read the value in Col 1, Row2 and does the same check .
Once it completes the check on all values in Col 1, it does the same with Col 2 (where the values are compared to the baseline value for Col 2) ... and so on until all the colums of the PIvor table are validated in the same manner .
I am using Excel for Mac 2011. I am trying to conditionally format the cells that apply to each row in the table with the exception of the grand total (listed as the bottom row). Depending on the filter applied by the user, the number of rows can go from 1 to 10. I have seen where some people have applied based on whether the cell showed a sum of some component in the source data. I am looking for this within the Mac version and have not found it. Do I need to write something in VBA to format it after refresh?
I am running office 2007. I am using conditional formatting in a pivot table to highlight rows where the value in the last column meets a particular criterion. However everytime I update the table the formatting gets lost. I have looked through all the threads I can find to establish if there is some VBA code that I can use to reapply the required conditional formatting after each update
I am having trouble getting some conditional formatting to apply to all cells in a column in a pivot table. Currently, the conditional formatting is only applying to the top level items in the pivot but is not applying to the lower level items. I can see why it is doing this. the range in "Applies to" is only specifying the rows that contain the top level items. I tried to change the range to D10:D647 but, it reverts back to just the top level items. How to get it to apply to everything?
I am using Excel 2010. I have a pivot table where I want to highlight the ENTIRE row where a certain cell value equals something.
In essence I want all the Material Subtotal Rows highlighted "Orange" But as you can tell from the picture below I am having issues with the Body of the Pivot table. I have the formula checking to find whenever it finds the word total to highlight it.
The example below is showing how I need the row to be formatted. I can get the Data (Units) section formatted no problem. It is just the other part of the pivot table that I cannot format.
For the columns from Material to SAP # I have been trying to use Dynamic Name ranges using the Offset function. However, excel turns that Name range to a range and if I filter the pivot table, it adds extra ranges to the Applies to box and starts to really mess it up.
Is there a way for a macro to capture the CURRENT colorindex value of a cell that has conditional formats? It seems to capture the default colorindex rather than the one that is currently displayed based on the conditions. I need to capture the current one.
I am trying to find a way to write a code in VBA to conditional format Bars on a pivot chart to change colors based on if the field beats the forecast field.
I am attaching the sheet which explains it better.
I would like the bar series in the chart to show green if it beat forecast and red if it didn't.
I want the macro to do this for all the pivot charts.
A report is written in a massive text file, and i've got my code to shrink it down, tidy it up and spit out a nice pivot table which my manager wants to be pretty colours (colors for US spelling). So far i've go this (which i recorded lazily):
ActiveSheet.PivotTables("PivotTable2").PivotSelect "Division[Numerical]", _ xlDataAndLabel With Selection.Interior .ColorIndex = 35 .Pattern = xlSolid End With
Now - what happens if there are no entries for the "Numerical" division? ERROR!!! How can i get some kind of "IF this division is present - color 35 please, if not, carry on" command? I have experimented til all the cows have come home, but i still end up with errors and freezing.
I am trying to run the macro below but keep getting Error 5, any ideas why this is at all.
Sub Quarterly07() Dim PTCache As PivotCache Dim PT As PivotTable 'Create the cache Set PTCache = ActiveWorkbook.PivotCaches.Create(SourceType:=xlDateBase, SourceData:=Range("A1").CurrentRegion)
' Add a new sheet for the pivot table Worksheets.Add 'Create the pivot table Set PT = ActiveSheet.PivotTables.Add( _ PivotCache:=PTCache, _ TableDestination:=Range("A4"))
Upon opening an existing file, I receive the following error: Unable to Read File….I then click OK, Enable the macros and upon doing so, the following message appears: Excel Table Report on [Sales] Sheet1 was discarded due to integrity problems.
I have two Pivot tables on the report – Pivot8 and Pivot1 – two separate worksheets but using the same source data. I have placed a button on each worksheet to enable the user to refresh the Pivot Table. Pivot1 is the table that is being discarded and when I click the button on Sheet1, the following Run time error 1004 appears: Unable to get the Pivot Tables property of the Worksheet class….when I select Debug, here’s the code with the bolded section being the point of error:
I am using conditional formatting to highlight all cells where the value <> 0.00. It's working for 98.9% of the records, but for some reason, about 5 of the records with 0.00 are being highlighted for some reason. I've checked the field formats and they're the same as the other numbers.
I have a lot of data (regarding graffiti) in a table and all my formulas work well. But, because I sometimes make an error in two columns of data I sometimes get results that do not balance. I want to put in a conditional format (?Is there a better way?) that will highlight the error as I enter the data. Can you help please?
Using Excel 2003 (sp3) and no add ons. There are lots of identical rows, 5:400, making up a table. I will use row 10 as an example.
In column M there is a formula which may or may not give a visible result. (It's a measure of the number of days taken to clean the graffiti and will only hold a result if the job has been finished.) The result for "M10" will be a number between 0 and 5 90% of the time, but may creep up to 30. It may also leave the cell looking blank although the formula itself is still lurking out of sight.
A matching row of cells, O10:T10, have no formulas in them. I must manually enter a "w" or an "a" into ONE of these columns, depending on the graffiti location (Worthing or Adur) and property ownership (Columns for residential, commercial, council etc.)
So now the errors I need to flag up as I enter data are to ensure that M and O:T balance. There should always be a result in M if there is an entry somewhere in O:T and if there is an entry in M there must be an entry somewhere in O:T.
Sometimes I mistakenly put an entry in O:T even if there was no result in M. Sometimes there is a result in M and I fail to put an entry in O:T. I need to be alerted as this happens, if possible. It will save hours of trying to track down my data entry errors.
BUT, there is already one conditional format already in M. It highlights the cell if it goes over 5 days for cleaning. =ISNUMBER(M10)*(M10>5).
If you can help, thank you very much. I thank you, my wife thanks you for me not doing overtime trying to track down my errors, my boss's thank you for making me more efficient and other forum readers may thank you for helping them to improve their sheets.
I can set a cell to format if its own cell contains an error, but is there a way to conditional format if the next cell over contains an error? For example, turn A1 red if B1 contains an error?
I have the following issue and hope someone can help:
I'm setting a conditional formatting formula in a range of about 2000 cells using VBA. The procedure works fine on my PC, but generates "runtime error 5" on all of my colleagues PC's. (We all use the same version of Excel 2003).
Pivot Tables. I've created a very simple one where my Row Lables are Salesperson then date and the second column is Sales. It looks "backwards" to me, because each salesperson's total sales for all dates combined is ABOVE the data by date. To make it worse, there's a line below the name, which looks like it's separating the name from the next few lines! With the next salesperson's name in the same "block" as the previous salesperson's details, it's very confusing! It would make more sense to me to have each salesperson's total be at the BOTTOM of their section!
My data has various dates in column A, which I group into months using the formula "=DATE(YEAR(A2),MONTH(A2),1)" in column B. Then I format column B to show the results in the format mmm-yy. So far so good.
I then use a pivot table to count the number of entries for each month and I have formatted the date column the same way. But every time I refresh the data (which I need to do frequently as data floods in from external sources), the format of the pivot table reverts to dd/mm/yyyy and I have to go and manually reformat it again.
I've checked all the options I can think of, but cannot find any way to keep the format as I have set it. Does anybody know of a way?
I'm using Excel 2003 on Windows 2000 Professional.
I am having difficulty with the pivot table I created in that the name of the month is showing the serial number. In my spreadsheet, the data I have is:
cell B3 = 20070501 cell P3 = 05 { formula =MID(B3,5,2) } {}*not an array formula cell Q3 =May {formula =DATE(2000,P3,1) } custom formatting in cell Q3 with MMMM to retreive name of month
In my pivot table, I would like the name of the month "May" to be displayed but 5/1/2000 is appearing. What am I doing wrong? Must I always format my data in the pivot table to return the name of the month? Perhaps someone in the Excel spectrum knows of a better solution.
Whenever I make one with numbers, I get formatting for a number as below
1234567.78(no commas and 2 decimal places)
I normally want the formatting as 1,234,568 (comma inserted, no decimals,), (the last digit is changed just becasue of round off, other wise number in both cases is same).
Now I can double click the field, goto number--> number and then apply this formatting.
My question is whether there is a setting in excel somewhere so that this formatting will come as default (after I create the pivot table each time)?
it's possible to set up conditional formatting to compare values between two identically-formatted (i.e. same row and column) pivot tables?
I have two pivots from two different sources and I want to be able to visually identify discrepancies between the two. Both have dates as the row labels (same date range) and categories as column labels (some categories may not necessarily be present on both pivots but the format of the labels - i.e., the names of the categories - is consistent where there is overlap)
I've tried doing this with 'traditional' CF but whenever I manipulate the pivots (i.e. by selecting / deselecting an item in a report filter), the movement of the columns trashes the formatting and I have to set it all up again.
Figured, given the structure of the tables is essentially the same, there might be a smarter way of doing it (by referencing the pivot fields in some way)
I am trying to get some averages using pivot tables. However, whenever I set up my pivot table and then go to field settings and pick average, all I get are # DIV/0 errors in all the boxes where there were numbers.
I'm trying to add conditional formatting to a table, however I have never done this before. I would like the values in column AX to light up red if they are more than 1.5 times greater than last month's in columb AP. Attached is a picture of the table.
I have a table that I sort by the first column. The first column has section numbers, and I'd like for each section to alternate in colours so users can easily see the end of one section and the beginning of another. I've attached a screenshot of what it should look like visually, as well as a sample Excel chart
Was working on this problem for a poster: [URL] ......
I can't seem to get the pivot table/chart to format exactly as I desire. It seems that as soon as I add 'group by hour and day' Excel forces the formatting to AM/PM and I want to keep it military. I want to group by hour, so that data that occurs at 6:00 and at 6:30 are grouped, and I had to group by day so that 6:00 on 1/1 was separated from 6:00 on 1/2.
Attached is a worksheet which shows the desired chart format (not a pivot chart), and the attempted pivot chart. I want the pivot chart to match the 'simple' chart in look and feel. Any attempts to change the formatting of the row labels to 'h' is promptly ignored by Excel.
Note the two tasks that occur at hour 18 (one at 18:00 and the other at 18:20 (you will need to see the formatting to truly see the minutes)). Those should be combined in the pivot table (and they are) and on my 'adjusted' table (where I used SUMIFS).
In Excel 2007, is it possible to copy & paste a pivot table, and have the result look like a pivot table, but not actually be a pivot table? I want to keep the values and the formatting (the colors and borders, etc) but I want it to not actually be linked to the data or have the ability to change with dropdowns, etc. I've tried the usual copy & paste special (values) thing, and the other otions in the paste special box, but it doesn't keep the formatting.