How to conditional format with multiple criteria (Excel Pivot table) - excel

I have an Excel pivot table with no set boundaries (boundaries depend on what slicer option the user select).
In Column A: I have the store information such as daily sales volume and other value information. Since there are countless stores, this information repeats for each store. Sales_Volume column is placed in the VALUES section area in PivotTable Fields (Along with other columns that are also placed in the VALUES section, but I am only concerned with Sales_Volume column).
In Column B - xxx: I have the daily dates in the COLUMNS section area in PivotTable Fields so starting from Column B contains the Sales_Volume information for that day (Along with other values,but I am only concerned with Sales_Volume column). Every 9th row starting from row 13 contains the Sales_Volume value for that day.
What I want is for the conditional formatting to search for the the word "Sales_Volume" in Column A and for that Row color the cell red for any values in that row that are less than 200.
Does that makes sense? So ONLY every 9th row starting from row 13 would contain the conditional formatting (if the values are less than 200 in those specific rows only).
Any help would GREATLY appreciated!!

Perhaps a helper column could work for you...create another column with the formula of =AND(A1="Sales_Volume",B1<200). This would either return TRUE or FALSE, and you could conditionally format that column.

I found the solution if anyone is interested:
I used the same formula listed here: "=AND(B6<200, $A6="Sales_Volume")"
however, my fix came from selecting the entire workbook from the first row that I wanted the conditional formatting to be set on so my selected range was:
B6 - XFD1048576 and voila!

Related

Sum specific values in the Grand Total row of a Pivot Table

Many thanks for your help in advance. I need help finding a way to sum specific values in the Grand Total row of a Pivot Table based on the corresponding column label. The challenge is that the row that the Grand Total is in isn't fixed, meaning in one instance the Grand Total may be in row 9, then after data addition/removal, it will be in a different row. Also, multiple columns match the criteria.
The attached image show what the Pivot Table looks like. I2 and J2 show the output I need regardless of which row the Grand Totals are in.
Credit to #DavidLead for pointing me in the right direction. The three screenshots attached to this answer are a supplement to the guide for using the GETPIVOTDATA formula in excel. I am using Excel 365.
In the first screenshot, you will see the raw data reformatted to have our columns, i.e. Name, B, A, and Month. Cell N2 shows the total/sum for A. in January and the formula is shown in the second screen capture, Cell O2 shows the sum/total for A. for all months combined. The formula is also shown in the second screenshot.
Regardless, you will see in the formulas for N2 and O2 that I reference the cell $G$1. This tells the formula which pivot table to look for the "A.". Then in the third position of the formula, I reference the Pivot field list column name "Month", and in the third position, I specify "January".
The formula can return 1 to 126 pairs of field names and item names that describe the data that you want to retrieve. In my case, I could have retrieved the total for John in January or for all months.
For example,
Total for John in January
=GETPIVOTDATA("A.",$G$1,"Month","January", "Names","John")
Total for John, January thru March
=GETPIVOTDATA("A.",$G$1,"Month","January", "Names","John")+GETPIVOTDATA("A.",$G$1,"Month","February", "Names","John")+GETPIVOTDATA("A.",$G$1,"Month","March", "Names","John")
The benefit of this formula is that if the Grand Total row changes I will always get the sum of A. and/or B. for all months. It is dynamic and is what I needed to accomplish.
Formula Explanation
`=GETPIVOTDATA("A.",$G$1,"Month","January")`
"A." = the column that has the data I need
$G$1 = the reference to the Pivot Table (Microsoft's
knowledge article states this can a reference to any cell, range of
cells, or named range of cells in a PivotTable. This information is
used to determine which PivotTable contains the data that you want to
retrieve.)
"Month" = the column I need
"January" = the name of the row for the total I need
To get the total for "A." from January thru March, I use the following formula:
=GETPIVOTDATA("A.",$G$1,"Month","January")+GETPIVOTDATA("A.",$G$1,"Month","February")+GETPIVOTDATA("A.",$G$1,"Month","March")
The most important factor of this formula is that you reference a cell in your pivot table. In my case, I used $G$1. I also tried other cells in the pivot table as reference cells, and the formula returned the correct values.
I hope this helps the next person who needs a similar solution and finds this answer. Please give this a vote if it helped you.
1st Screenshot
2nd Screenshot
3rd Screenshot

Trying to reference data in variable rows after matching specific cell in excel

In Excel I'm trying to paste in weekly time card reports and then reference the bottom line of each section which contains the yellow highlighted text string in column B (report contains 15-20 sections with variable row differences).
Without using VBA, is there a way to identify an employee ID (Column A), then calculate how many rows below that ID that the last text string cell is located in column B (Highlighted in yellow in the example). Then use that row difference to offset the INDEX formula to grab correct row from the table.
I was using INDEX/MATCH to find the employee ID and then trying to offset the row return per employee manually when I realized that the different job codes rendered that formula inaccurate.
I had used this to reference the proper columns with the offset for one of the weeks, but each week varies. The "+17" at the end of the below formula is where I need the variable row difference to grab the yellow highlighted cell.
=INDEX($A$1:$A$100,(MATCH(A61,$B1:$B$100,0)+17))
Thanks in advance, hopefully I provided the right info to answer the question if there is a solution!
after a revamp of the thought process, the following formula will return the information corresponding to as specific employee and their tax information which is stored in column B in a cell with "EFURTA" in it. No other cell in B within the employee block can contain "EFURTA". If that happens only the first occurence will be returned.
Assuming your data is layed out per the image below, the following formula will return the information you are looking for:
=INDEX(B:B,AGGREGATE(15,6,ROW($A$1:$A$80)/((FIND("ERFUTA",$B$1:$B$80)>0)*(ROW($A$1:$A$80)>MATCH(D2,$A$1:$A$80,0))),1))
Adjust the ranges to suit your data.
If you just want the row number, just grab the aggregate part of the formula and drop the index.

EXCEL: Searching a table of data with two criteria and outputting the rows to a new table

I have a table of data (Data!$A$8004:$F$10430) within an excel sheet which I need to search for all of the rows that contain the date displayed in cell: Data!Q27 (e.g may-2017) in column F of the table of data. And then output in a new table all of the rows which match that specific date (Data!Q27 changes, but is always in the MMM-YYYY format)
I created a similar solution for another table which worked, however for this data table it is not working. The working solution is shown below:
=IF(ISERROR(INDEX(Data!$A$1:$K$7523,SMALL(IF(RIGHT(Data!$A$1:$A$7523,7)=Data!$Q$25,ROW(Data!$A$1:$K$7523)),ROW(1:1)),1)),"",INDEX(Data!$A$1:$K$7523,SMALL(IF(RIGHT(Data!$A$1:$A$7523,7)=Data!$Q$25,ROW(Data!$A$1:$K$7523)),ROW(1:1)),1))
(This differs slightly as the date format in the table and Data!Q25 is /mmm/yy, but it successfully creates the new table which changes values dependent on the value in Data!Q25)
The format of the date in column F is e.g 09-May-2017 and is classified as 'general' type.
I have used this formula, and I get no error or value on the cell that this code is on:
{=IF(ISERROR(INDEX(Data!$A$8004:$F$10430,SMALL(IF(RIGHT(Data!$F$8004:$F$10430,8
)=Data!$Q$27,ROW(Data!$A$8004:$F$10430)),ROW(1:1)),1)),"",INDEX(Data!$A$8004:$F
$10430,SMALL(IF(RIGHT(Data!$F$8004:$F$10430,8)=Data!$Q$27,ROW(Data!$A$8004:$F$1
0430)),ROW(1:1)),1))}
The formula is formatted as an array, and therefore I believe this code should work, returning the first A column value of a row which fits the criteria of having, for example: "***May-2017" in its F column. However it doesn't.
Unfortunately due to corporate protection I am unable to share the spreadsheet, but if the information supplied in this isn't clear enough I could supply a new excel sheet to show my example?
https://drive.google.com/open?id=1NpS0_Bsy8XuicrPl8oy5tAswEa9QZ9X2 <- here is a spreadsheet that I have recreated to show the issue. The real spreadsheet is different, but this shows the purpose of my problem. Regardless of there being values which should be picked up on the tab names 'Data for normal user', no data is shown.
Thank you for your time!
Your formula is correct, however you haven't offset the rows.
Your INDEX() is starting at row 8 so this will be the first indexed row. SMALL() is building an array of the exact row numbers so row 8 in SMALL() is row 1 in the index, therefore no results are showing.
You simply need to update the IF() within SMALL() to handle this offset: (This formula has been updated to respond to formula dragging, i will include your original after)
=IFERROR(INDEX(ConfidentialLiveData!A$8:A$14,SMALL(IF(RIGHT(ConfidentialLiveData!$F$8:$F$14,8)=ConfidentialLiveData!$C$2,ROW(ConfidentialLiveData!$A$8:$A$14)-7),ROW(1:1))),"")
Or
=IF(ISERROR(INDEX(ConfidentialLiveData!$A$8:$J$14,SMALL(IF(RIGHT(ConfidentialLiveData!$F$8:$F$14,8)=ConfidentialLiveData!$C$2,ROW(ConfidentialLiveData!$A$8:$J$14)-7),ROW(1:1)),1)),"",INDEX(ConfidentialLiveData!$A$8:$J$14,SMALL(IF(RIGHT(ConfidentialLiveData!$F$8:$F$14,8)=ConfidentialLiveData!$C$2,ROW(ConfidentialLiveData!$A$8:$J$14)-7),ROW(1:1)),1))
A quick tip for error handling formulas is to use F9 when highlighting sections of your formula to show what that is calculating. For example i highlighted IF(RIGHT(ConfidentialLiveData!$F$8:$F$14,8)=ConfidentialLiveData!$C$2,ROW(ConfidentialLiveData!$A$8:$J$14)) and saw that that calculated as {8;FALSE;10;11;FALSE;FALSE;FALSE} so the match was being found just that the row numbers being returned were not what we were looking for.
Update:
So your formula is starting on row 8004, that row in the index is row 1. To get that row returned you need to take away 8003 from the 8109 to give you the 106th indexed row. A common way to do this is to take away the starting row and add 1 which in your original formula would be: {=IF(ISERROR(INDEX(Data!$A$8004:$F$10430,SMALL(IF(RIGHT(Data‌​!$F$8004:$F$10430,8 )=Data!$Q$27,ROW(Data!$A$8004:$F$10430)-ROW(Data!$A$8004)+1)‌​,ROW(1:1)),1)),"",IN‌​DEX(Data!$A$8004:$F $10430,SMALL(IF(RIGHT(Data!$F$8004:$F$10430,8)=Data!$Q$27,RO‌​W(Data!$A$8004:$F$1 0430)-ROW(Data!$A$8004)+1),ROW(1:1)),1))}

Excel - to format the data in a more readable way

Is it possible to get the above table in a format such as the table below, in a much easier manner without having to do a brute force approach of creating 9 columns for the LTV band and assigning it a PD value in the table?
Excel... Insert Pivot table
Select range and fill in as layed out in image below.
you can hide grand totals if you want by right clicking on the pivot table and selecting Pivot table options then the totals & filters
There are many other features as well but this gives you the general idea.
As to missing LTV values, you just need blank rows for each value so the chart pivots on all the data.
OK, Here's an idea
You can do what you want using a complicated index formula that checks the Year and the Month and other number but it's quite complicated, so.
Use a formula to create an ID column to the left of your data and you can use a fairly simple vlookup to extract the data.
The ID will be the YEAR + MONTH + B + I.TV number. On my sheet the formula is.
=C2&D2&"B"&E2
Next create your new table by listing the Years and Months and entering in the headings B1 to B9. Then put your vlookup in the first cell under B1.
=iferror(vlookup($A12&$B12&C$11,$B$2:$F$9,5,false),"")
It's not too complicated, $A12&$B12&C$11 builds the ID we want to search for using the Year, Month and Heading B1 cells. Pay attention to the way the cell references are locked as that allows you to autofill across and down while still referencing the headings etc. $B$2:$F$9 is the range you want to use for the vlookup and 5 is the column with the data you want to return.
Have a look at my example below.

Highlighting rows based on the absence of another row

I have a data Sheet that I need to highlight rows based on certain conditions
I have been successful in highlighting duplicate rows using the following formula in conditional formatting:
=COUNTIFS(Employee_Col,$D1,Job_Col,$E1,Date_Col,$F1)>1
and applying it to all the cells in the data sheet
Employee_Col refers to the emp_ID
Job_Col refers to the job_ID
I have created named ranges for the columns in question as per above
I have a separate sheet(Employees) which includes and emp_ID and a type column where I can specify if they are a "Supervisor"
What I'm trying to accomplish is to highlight rows in my Data sheet where I have entries(rows) emp_ID, job_ID, Date but there is no entry for a job_ID, Date combination for an employee designated as a "Supervisor" from the Employee sheet
In other words if there are regular employee entries for a given job and date but no corresponding supervisor employee entry then I would like to highlight the regular employee entries for this given job/date combination
The emp_ID, job_ID, Date entries in the Data sheet can appear anywhere in the Data i.e. they are not necessarily adjacent(by job_id/Date) to one another.
"Supervisor" entries can be added to the Employee sheet at any time so I need the highlighting provided by the conditional formatting to be reflected automatically in the Data sheet.
Hope I'm clear with my intentions, any help would be greatly appreciated.
Adding Screenshots to help explain my intentions...
From the Employee sheet employees 1, 4 and 6 are designated as "Supervisor" in column D
The Highlighted rows in Data_Before_After is the result I'm looking for.
The rows highlighted have no corresponding "Supervisor" entry for the indicated Date and Job
Perhaps I need a helper column that performs the INDEX/MATCH lookup on the Employee sheet to get employees who are supervisors and use that column as well in the conditional formatting.
Just not sure how to get there.
If it can't be done in excel is there a VBA solution?
Thanks again.
Data_Before_After
Employee

Resources