Excel Conditional formatting on two criteria in a separate table - excel

This is a reporting presentation exercise...
I am looking for the magic to change the colour of the cell without changing the contents of the cell.
I have a type of crosstab table, which has the ROWS individual CustomerIDs, and the COLs as months.
PRESENTATION TABLE
CustomerID
Jan 22
Feb 22
Mar 22
0001
$100
$50
$10000
0002
$1000
$1000
$200
....
....
...
And in a separate table, I have some data which I want to use in a conditional formatting type of way.
LOOKUP TABLE
CustomerID
Period
Label
0001
Feb 22
Applied
0001
Mar 22
Pending
0006
Mar 22
Approved
0009
Dec 23
Pending
Let's say that if the CustomerID and Period in the data table has the label "Applied" then I want that cell in the top table, where CustomerID and Period intersect, to be coloured RED. If it's "Passed", I want it to be coloured green, and so on.
The periods are dates data types. The tables are excel tables.
The dollar value in the cell has nothing to do with it.
I've seen some techniques where a combination of Named ranges and confditional formatting are used, but I'm stumped.
I can put the dollar values in the correct cell by putting a helper column into my source data (the second table) and then doing an xlookup on the combination of the row and col headers, against that helper column.
But then I run out of steam.
END RESULT
CustomerID
Jan 22
Feb 22
Mar 22
0001
RED
BLUE
0002
....
....
...

Conditional Formatting On Two Criteria In A Separate Table
This is what I have tried,
• Formula used in Conditional Formatting for Applied
=COUNTIFS($F$2:$F$5,$A2,$G$2:$G$5,B$1,$H$2:$H$5,"Applied")=1
Special credit to Scott Craner Sir for the above formula
• And for the Pending you may try using SUMPRODUCT() or COUNTIFS() Function as well, both way it works,
=SUMPRODUCT(($A2=$F$2:$F$5)*(B$1=$G$2:$G$5)*($H$2:$H$5="Pending"))=1

Related

Need to revise this formula that displays data based on another cell's contents

I can't get this formula working properly. Here is what I need to do (see included image below):
I need the data in rows 9-10 (sales) to be displayed/copied in rows 28-29 (collections) based on the number in cells C9 and C10 (payment terms). For example, if there are $1,900 in GM sales on Tuesday, Jan 5 (cell F9) and payment terms are 10 days (cell C9), then I need $1,900 displayed on Tuesday, Jan 19 (cell P28), in the collections section (rows 28-29), 10 business days from when the sales were made. Does this make sense? Here is the formula I am using now (starting in cell E28 and being dragged to the right):
=IF(COLUMN() - E9 < 1, 0, INDIRECT(ADDRESS(9, COLUMN() - $C$9)))
However, it is not working completely. It is moving the data labels to the left of the data table that are not supposed to be included in the data table. Only sales data starting in cell E9 are supposed to be moved. You can see this issue in row 28 (columns J-N) in the image below.
This formula also has to work with payment terms from 1 day - 10 days. So, the $5,000 in Ford sales on Monday, Jan 4 (cell F10), with payment terms of 3 days (cell C10), needs to be displayed on Friday, Jan 8 (cell I29).
Let me know if you need any additional details to solve this issue. Thanks!
Is this what you're looking for?
=IFERROR(INDEX($E$9:$X$13,MATCH($B28,$B$9:$B$13,0),MATCH(WORKDAY(E$5,-INDEX($C$9:$C$13,MATCH($B28,$B$9:$B$13,0))),$E$5:$X$5,0)),0)
The formula indexes the sales amounts and shows the amount in the row where the customer name mentioned at sales equals the customer at the result section with the column where the result date equals the date mentioned at sales minus the number of workdays mentioned behind the customer name at the sales section.

Copy Data from once cell to another cell based on conditions

I am facing an issue in excel in driving the formulas. I have data (Year, Salary, Name) in one sheet. It is updated vertically. In another sheet, I want to get list of salary for particular year. For 2019 there may be 4 rows for salary so I want all of them one by one. Below is the data:
Salary EMP Year
10000 a 2017
11500 b 2018
13000 c 2019
14500 d 2017
16000 f 2018
17500 s 2019
19000 g 2017
20500 h 2018
22000 h 2019
Output I require:
Year 2017 2018 2019
10000 11500 13000
14500 16000 17500
19000 20500 22000
So output should contain list of data for 2019 when I enter 2019 (all rows). there may be 50 rows in actual as I have given simple example of 8 rows only.
Kindly help me on this.
Thanks, Sharmil
I tried with pivot but it is giving total value rather than individual values. Also I tried with OFFSET, Index + Match function but it does not provide me correct output. Combination of OFFSET, Index + Match gives all rows for all single year.
Excuse me for the German language. SUMMEWENN is, indeed, SUMIF function. You can use a sumif Formula:
Sumif(Your criteria, Your search criterua, Your desired range to be summed)
Please see the below screenshot illustrating your example
Your criteria: Range C2 to C11
Your search criteria: B5 --> 2017
Your desired range to be summed: A2 to A11
Pivot Table is a possible solution but you will need a helper column to "rank" the Year.
Put the following formula in Cell D2 suppose your data range is A2:C13:
=COUNTIF($C$2:C2,C2)
Dray it down to apply across rows.
Then sort the data range by Year and then by Salary from Smallest to Largest.
Then insert a pivot table and layout the data as shown below.
The problem can also be solved by formula or power query but if a list like that is all you want I believe using Pivot Table is the most efficient way.
Let me know if you have any question. Cheers :)

What is the best way to use Index Match in this case?

In the primary worksheet, I have a list of employees in column A, from columns D:ZZ I have basically a calendar in row 11. Where these intersect, I have assigned a task code to each employee to illustrate what they are employed to do that day. I want to dynamically color the coded cell based on the date in the row 11 and code from the column that it was entered. In my second sheet, I have a table of the codes along column A. From columns B:AM, in row 2 (under the header) I have another code that says what type of work it is, in office, on the road, etc. This is the code I am trying to look up with Index Match. In the row with the task code, under each header I have a scheduled date that that particular job will be either in or out or nothing.
I can Index the task column pretty easily, my problem is how would I take the row I get from that, then search only that row for the date that I applied the code to the employee to return the result from row 2 and the column that that date appears?
I have a pretty good understanding of Index/Match in looking up multiple items to return a result. I am having a problem creating a range from a result to find the data I want.
I have tried Indirect and Address as well as Offset, but I don't want this to be volatile as it is being used in conditional formatting over several thousand cells.
Task Code Schedule Worksheet
DAY 1 2 3 4 ...
CODE A S A F ...
96T003 03 May 04 May 05 May 06 May ...
96T004 05 May 06 May 07 Jun 10 Jun ...
96T005 05 May 19 Jul 22 Jul 23 Jul ...
Primary worksheet
SAT SUN MON TUE WED
DATE 01 02 03 04 05
JONES OFF OFF 96T003 96T003 96T004
DAVIS OFF OFF 96T003 96T003 96T005
This formula works, but is "volatile" and I am leary to use it in a conditional formatting function. Is there a way to make it not as volatile?
=INDEX(CMP_FLYCODE,1,MATCH(F11,INDIRECT("'CMP'!"&ADDRESS(MATCH(F19,CMP_ADP,0),1)&":"&ADDRESS(MATCH(F19,CMP_ADP,0),40)),0))
CMP_FLYCODE is a reference to just the A, S and F code row
Expecting to return a letter code A, S or F based on the date and code
Edit: Added the header to the code schedule that is a unique number for the day of the task 1, 2, 3...
I don't think it's too bad, you can just get the entire row from the 2d array B3:E5 in the task sheet using index with the match for the task code in the row parameter and 0 in the column parameter, then match the date in that and use index again to get the required letter code.
This is what my formula looks like:
=IF(C3="OFF","",INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0)))
This is my primary sheet:
This is my task sheet:
So to use this in conditional formatting, you would need three rules using custom formulas
=INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0))="A"
=INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0))="S"
=INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0))="F"
with appropriate fill colours.

How to find number of matching values with an ID?

I have a unique list of IDs of people on two separate sheets. One for initial 'registration data' which is the master data list. In column A is the ID, column B is their town of residence and column C is the date in which the person was added to the list.
I send out sheets to the different towns every month to receive some more data about the new people added to the list, and every month (the same month) they should send it back to me. This received data goes onto a second sheet, with again: column A for person, B for town, and C for month data received.
I need to check how accurate the towns are in getting the data back to me on time. So I need to count the number of forms on the second sheet where the month is the same as the initial month on sheet number one, and the towns match too.
I have tried COUNTIFS with VLOOKUPs but am having no luck. I want to avoid having to make an interim data table as much as possible because I need the process to be slick and automatic.
Could this be done with a SUMPRODUCT?
For example:
Sheet 1 (initial) Sheet 2 (received)
123, TownA, Feb 123, TownA, Feb
124, TownB, Feb 124, TownB, Mar
127, TownB, Mar 127, TownB, Mar
130, TownC, Mar 130, TownC, Mar
220, TownC, Apr (we didn't receive back 220)
OUTPUT SHEET
Feb Mar Apr
TownA 1 0 0
TownB 0 1 0
TownC 0 1 0
As you can see, of the five forms we only received three in the month we were supposed to. I want it in the view above, and don't really want to have to make a new sheet with the IDs to match the months up.
In Sheet3 with Feb in C1, Mar in D1 and Apr in E1 and 123 etc in A2 etc, in B2:
=VLOOKUP(A2,Sheet1!A:B,2,0)
in C2:
=(INDEX(Sheet1!$C:$C,MATCH($A2,Sheet1!$A:$A))=C$1)*(INDEX(Sheet2!$C:$C,MATCH($A2,Sheet2!$A:$A))=C$1)
C2 copied across to E2 and B2:E2 copied down to suit.
Then select A:E and DATA > Subtotal At each change in: (ColumnB), Use function: Sum, Add subtotal to: check Feb, Mar, Apr, Summary below data and OK.
Copy A:E, Paste Special, Values over the top and apply filter. Filter ColumnB, Text Filters, Custom Filter..., contains Tot, OK.
In the first populated cell in ColumnB enter =Bn (where n is the row number immediately above that cell, though not visible) and copy down to suit.
Hide or delete the totals row to suit.

Sum a column in Excel based on two references in the column and two filter reference columns

I need to sum the valumes of a column, but I need to identify the column based on two values in the column and I have to filter it by the values in two adjecent columns.
Here is an example:
Reference1 Act. Act. Act. ... Bud. Bud. Bud.
Reference2 Jan Feb Mar ... Jan Feb Mar
Reference3 Reference4
CAR BLUE 1 2 3 4 5 6
CAR BLUE 1 2 3 4 5 6
CAR RED 1 2 3 4 5 6
So, I have to add all the CAR & BLUE & Act. & Jan = 1+1 = 2. And similarly for the other columns.
I would like to achieve something as follows:
Reference3 Reference4 Reference1 Reference2 Value
CAR BLUE Act. Jan 2
CAR BLUE Act. FEB 4
The problem I have is that formula to use in the Value column above. I can not do a SUMIFS as the columns in the original source table change. A VLOOKUP don't work as there is no single column for the lookup_value. I thought about using MATCH to identify the column, but as I have two references(1&2) it doesn't work either.
Any ideas on what formula(s) I could use to achive the above.
Thanks
Try making a pivot table from your data (this will not make formulas, though, but will nevertheless give you the desired results).
Here is a simple guide on doing that in Excel 2003 - http://www.techonthenet.com/excel/pivottbls/create.php
You can create a Key in a column:
= Reference3 & Reference4 & Reference1 & reference2
and after use the Subtotal command (Inside Data).
Every time you modify the data, you need to reuse Subtotal

Resources