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

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

Related

Excel Conditional formatting on two criteria in a separate table

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

Move a this cells value to this cell if it equals this [duplicate]

I know this might not be the best place to ask a purely excel question, but. I have a table with the following headers: Number, Date, Name. In another file I need to link the number with the name. It is not always in the same order, hence the VLOOKUP formula. Here is the data below.
1 15-Nov Allen 15-Nov
10 15-Nov Allen 15-Nov
19 15-Nov Allen 15-Nov
6 5-Mar Avalon 5-Mar
15 5-Mar Avalon 5-Mar
24 5-Mar Avalon 5-Mar
9 15-Nov Burg 15-Nov
18 15-Nov Burg 15-Nov
27 15-Nov Burg 15-Nov
8 1-Sep Fischer 1-Sep
17 1-Sep Fischer 1-Sep
26 1-Sep Fischer 1-Sep
3 14-Oct Kiser 14-Oct
12 14-Oct Kiser 14-Oct
21 14-Oct Kiser 14-Oct
2 15-Oct Remmert 15-Oct
11 15-Oct Remmert 15-Oct
20 15-Oct Remmert 15-Oct
4 1-Sep Roos 1-Sep
13 1-Sep Roos 1-Sep
22 1-Sep Roos 1-Sep
7 6-Feb Tomo 6-Feb
16 6-Feb Tomo 6-Feb
25 6-Feb Tomo 6-Feb
5 1-Jan Wash 1-Jan
14 1-Jan Wash 1-Jan
23 1-Jan Wash 1-Jan
So Lets assume it is titled as Column A, B, C, D. So in the new file in order to grab the name from numbers I used the formula:
=VLOOKUP(A1,[Workbook1]Sheet1!$A$1:$D$27,3,FALSE)
Workbook1 and Sheet1 is where the data is. Next I need to grab the date from the file by linking it to the name. I know I can link it to the number but it is a thing for work and the way they are arranged are with Different dates from oldest to newest, not the same like this one. The Date function in excel is extremely stupid in my opinion. So I used the formula
=VLOOKUP(B1,[Workbook1]Sheet1!$A$1:$D$27,1,FALSE)
and iterations of it by replacing the 1 with 4. It keeps returning N/A. Even when I change the formatting of the Date to General it still returns nothing. I dont get what I am doing wrong here.
VLOOKUP syntax:
VLOOKUP(lookup_value , table_array, col_index_num, (optional) [range_lookup])
The VLOOKUP function will always look up the lookup_value in the first column of the table_array. It then attempts to return the value in the col_index_num of the corresponding row in the table_array. The range_lookup tells VLOOKUP whether to look for an exact or an approximate match. In your case, you will be looking for an exact match.
In no way can VLOOKUP return a value in the table_array that is to the left of the column looking to match the lookup_value. The lookup_value is always looked for in the first column and VLOOKUP returns a value in a column to the right.
Your formula to look up the name based upon the ID number in column A works well for this.
=VLOOKUP(A1, [Workbook1]Sheet1!$A$1:$D$27, 3, FALSE)
With 8 in A1, the above formula returns Fischer in B1.
      
When you are looking to return the dates, VLOOKUP will work for the one to the right of the name in Sheet1's column D but it cannot the return the date from Sheet1's column B basing the lookup_value on the name. You will need an INDEX/MATCH function pair for that. In addition, retrieving the second and third date sets that match the name is easier with INDEX/MATCH than VLOOKUP.
INDEX and MATCH syntax:
INDEX(array, row_num, column_num)
MATCH(lookup_value, lookup_array, (optional) [match_type])
If you are looking to return the date from Sheet1's column B using the name just retrieved from Sheet1's column C, you will have to use an INDEX/MATCH pair. Since we are using this for one date, it is eaay to use it for the other although strictly speaking, VLOOKUP could be used for this.
Use these two formulas in C1 and D1.
=INDEX([Workbook1]Sheet1!B:B, MATCH(B1, [Workbook1]Sheet1!C:C, 0))
=INDEX([Workbook1]Sheet1!D:D, MATCH(B1, [Workbook1]Sheet1!C:C, 0))
Format the cells for a custom number format of d-mmm. Your results should be similar to the following.
      
If you wanted to return the second and third dates from Sheet1 that match the name in column B, change the target worksheet's C1 and D1 to to these formulas that use the SMALL function togewther with the ROW function and COUNTIF function to produce the additional dates.
Make a minor tweak to the formula in B1 so it can be filled down then supply the next two formulas for C1 and D1.
=VLOOKUP(A$1, [Workbook1]Sheet1!$A$1:$D$27, 3, FALSE)
=IFERROR(INDEX([Workbook1]Sheet1!B$1:B$999, SMALL(INDEX(ROW($1:$999)+([Workbook1]Sheet1!C$1:C$999<>B$1)*1E+99, , ), COUNTIF(B$1:B1, B1))), "")
=IFERROR(INDEX([Workbook1]Sheet1!B$1:B$999, SMALL(INDEX(ROW($1:$999)+([Workbook1]Sheet1!C$1:C$999<>B$1)*1E+99, , ), COUNTIF(B$1:B1, B1))), "")
Fill B1:D1 down down to catch all of the possible dates from Sheet1 that match the name returned from your original ID lookup. Your results should look like,
      
You may notice that I sequenced the identical dates on Sheet1 in order to demonstrate the method. The IFERROR function is used to display an empty string (e.g. "") instead of an error message when you run out of values (as in C4 and D4 in the above sample image).
In summary, use the VLOOKUP function to return values to the right of the value sought; use an INDEX/MATCH function pair to retrieve values from either side of the matching column.
I assume that B1 holds the name of the person. In that case, you need to adjust the range for the lookup table, so that it starts in the column with the name, i.e.
=VLOOKUP(B1,[Workbook1]Sheet1!$C$1:$D$27,2,FALSE)
EDITTED : Change the column to 2 to get the date
You need format the date with the following format :
This is the overall that I had done to solve the problem.

Formula for finding matching values

I have a table in excel that looks like this:
State Member DOL
MO LLC 1/1/2017
MO LLC 1/1/2017
MO TC 1/1/2017
IL TC 1/2/2017
IL LLC 1/1/2017
I am trying to use conditional formatting to highlight the whole row for any rows that have the same State, Member, and DOL value. In three seperate columns I am using a CountIf formula to find how many times each value is being used for each column: Example(=countif($A$1:$A$10,A1)). This is so that I can identify which rows have duplicates for each individual column. So in the above example my new table will look like this:
State Member DOL
3 3 4
3 3 4
3 2 4
2 2 1
2 3 4
I can't figure out what kind of formula I should use next to identify which rows are duplicates. In the example I showed, the first two rows should be the only ones highlighted because they are the only ones that have the same value for all three columns. Originally I thought that as long as all three columns have a value > than 1, then it's a duplicate. However, row's 3 and 5 in my example have duplicate values in each column, but the row itself is never actually a full duplicate. In the end, I would like some kind of formula that will give me this result in a column:
Is Duplicate
1
1
0
0
0
Anyone have any ideas?

Excel table : how can I change row and column?

I have a table excel with one column and X rows.
4 various informations
example:
row 1 2 3 4 = informations for 1
row 5 6 7 8 = information for 2
I would like to know how can I do to have these information by row instead of by column?
Example:
paul
madrid
14
victor
canada
23
emilie
paris
18
and I Would like:
paul Victor Emilie
Madrid Canada Paris
14 23 18
If you want change data only once, use Copy/Paste
Switch (transpose) columns and rows
Or if you want use formula
TRANSPOSE function
Or you can use the INDIRECT function instead. It's a bit tricky but it works :
On the same sheet where you have :
Paul
Madrid
23
Victor
Montréal
22
Aude
Copenhague
17
Valérie
Alger
28
Add something like (for example on columns B, C, D) :
1 2 3
4 5 6
7 8 9
10 11 12
etc.
It's easy to do with =X+3 formula and drag down formula.
Then, this matrix represent the position of each element in the list, you now just have to use INDIRECT in this way :
=INDIRECT("A" & B1)
A is the column where are your data
B1 is the position of the first element in the matrix
By draging this formula down and on the right, you will the matrix with the A's elements.
(Using example where source column in G2:G100 and target table in H2:J34.)
Type formula below in first cell of target table (H2):
=OFFSET($G$2;(ROW()-ROW($2:$2))*3+COLUMN()-COLUMN($H:$H);0)
Replacing $G$2 with first cell of source data, $2:$2 with first row of target table and $H:$H with first column of target table (mind the $).
Then just drag formula left and then bottom.

GETPIVOTDATA formula to return the total of a item within a given month

In my pivot table. I have my data setout like this..
M1 M2 M3
Country Item
Australia Item 1 5 3 3
Item 2 3 6 7
Item 3 4 6 6
Australia Total 12 15 16
Belgium
Item 1 4 5 7
Item 2 5 8 3
Item 3 3 7 3
Belguim Total 12 20 13
What im trying to do is get the total of Item 1 in M1 (which is 9) using the GETPIVOTDATA function.
Ive already been able to get the Country Totals for M1 using "Australia Total" "M1".
I thought this was possible, but looking at Excel 2010 help it seems to say that you can only refer to a total that's visible somewhere in the table. So, I think you need another pivot table that has doesn't include countries. Or you could change the one above so that Countries are to the right of Items. Then point your GetPivotData formula at that.
The specific line from the Excel page linked above is the last one: "returns #REF! because there is no total value of beverage sales for Davolio."
EDIT: If you want to use variables in your GetPivotData formulas this Contextures page has some great tips, especially the one at the end about referring to the Data field.
Only numbers shown on the sheet can be returned by returned by the GETPIVOTDATA function. In this case the solution could be to drag the Item field to the column. If now a cell with the number 9 is shown, you are able to retrieve it.

Resources