Excel: match in a column with another column based on a non blank value in another column - excel

I have 2 arrays. The first array lists account nr's with the company name and a column that tracks if they were active last month (marked with an x). The second array has two column; one with only company names and another that needs to be marked with an x if the company is present in the first array in January.
Objective: I want to track active companies in January. To do this, I want to mark the second column in array 2 for all companies that have an 'x' in 'active Jan' in array 1.
Array 1
Name Company[1]
account nr.
active Jan
A
123
x
B
321
B
132
x
Array 2
Name Company[2]
active Jan
A
B
What I tried: formula in [array 2,column 2] that gives the value in [array1,column 3] based on a match between name company in array 1 and array 2:
=IFERROR(VLOOKUP([#NameCompany[2]],'array1'!A3:C5,3,FALSE),"")
Result: This gives the first blank or x values of a company in array1. I need to only give an 'x' in [array2,column2] if there is an x in ]array1,column3], instead of copying the first value in [array1,column3] the formula comes across.
For example, the formula above would give a 0 value (or blank) for company B instead of an x because there are multiple accounts from company B. Ideally, the formula should search only companies with an 'x' in [array1,column3] and then put an 'x' in [array2,column2].
I know I use the wrong formula to reach my objective but I can't find the right one in google/stackoverflow. Please help.

You can use this formula:
=SUMPRODUCT(('array1'!$A$3:$A$5=[#[Name Company'[2']]])*('array1'!$C$3:$C$5="x")) > 0

i've already to chehck it, and found what u want
please try to use my Formula
=IF(LEN(VLOOKUP(A11,$A$2:$C$5,3))=0," ",VLOOKUP(A11,$A$2:$C$5,3))

Related

How to select a value from another MATCH formula if first MATCH formula returns null in excel

I don't know how possible this is but i want to be able to get a value in a row where the values used to MATCH might not always be on the same column.
Example:
Sheet 1
#
A
B
C
D
1
name
age
work email
personal email
2
dave
20
dave#work.com
3
matt
25
matt#home.com
Sheet 2
#
A
B
1
email
name
2
dave#work.com
fx = dave
3
matt#home.com
fx = N/A
fx
=INDEX('Sheet1'!$A:$A,MATCH(A2,'Sheet1'!$C:$C,0))
the formula works fine but i want to be able to search column D if formula returns N/A when a match can't be found in column C
Please help me out.
You could use IFERROR for this.
=INDEX(Sheet1!$A:$A,IFERROR(MATCH(A2,Sheet1!$C:$C,0),MATCH(A2,Sheet1!$D:$D,0)))
An alternate approach when you don't know what column to find your match is to use SUMPRODUCT combined with ROW:
=INDEX(Sheet1!A:A,SUMPRODUCT((Sheet1!C:D=A2)*ROW(Sheet1!C:D)))
Please note that if there would be two matches within the data, the value returned by SUMPRODUCT is a sum of the matching row numbers. If there's only one match this formula works fine.

Choosing minimum value and corresponding columns in Excel

I have an Excel Spreadsheet containing elements in 3 columns
Name Number Time
A 1 0.425
A 2 0.123
B 1 1.0256
B 2 0.564
B 3 0.7895
C 2 0.256
C 5 0.458
I want to choose minimum Time and corresponding Name and Number. I have tried it with pivot table and retrieved Name and minimum Time but could not get the corresponding Number column value.
EDIT :
Just to explain further. For each corresponding Name i want to choose minimum Time and then corresponding Number against that minimum Time. E.g. Output for above table should be like this :
Name Number Time
A 2 0.123
B 2 0.564
C 2 0.458
You need three formulas
Extract list of unique Name
This formula is an array formula so needs to be confirmed by holding down ctrl + shift while holding down enter
E2: =IFERROR(INDEX($A$2:$A$8,MATCH(0,COUNTIF($E$1:E1,$A$2:$A$8),0)),"")
minimum time for the Name
G2: =AGGREGATE(15,6,1/(E2=$A$2:$A$8)*$C$2:$C$8,1)
matching number for minimum time for name
F2: =AGGREGATE(14,4,(E2=$A$2:$A$8)*(G2=$C$2:$C$8)*$B$2:$B$8,1)
The screenshot below should clarify where the formulas go and the referred ranges:
Assuming your data is in A2:C8, you can use the formula:
For Name:
=INDEX(A2:C8, MATCH(MIN(C2:C8), C2:C8, 0), 1)
For Number:
=INDEX(A2:C8, MATCH(MIN(C2:C8), C2:C8, 0), 2)
A PivotTable can indeed do that for you:
This is accomplished by setting a Top 1 Values filter as follows:

Vlookup and sum all instances of the matching lookup

this is probably an extremely basic problem but I can't figure a way to do this within Excel.
I have a list of values IDs from a regional sales manager,
he wants to see if his figures have been inputted into the monthly report and are reporting correctly.
However, as he sells by region and we report by product we have multiple instances of his ID by Product
so our monthly report.. for example
ID Value
1 16,999
1 22,521
3 400
3 221
5 71
6 22,000
So he has provided me with a list of IDs
1
2
3
4
5
6
and wants a list with its total revenue not just the first match up.
Is an excel limitation or is there a way to do this?
You can use a SUMIF formula. Basically you give it the column to check the value of, then you give it the expected value and finally the colum to sum.
Option 1 (whole range)
=SUMIF(A:A, 1, B:B)
Option 2 (defined range)
=SUMIF(A1:A7, 1, B1:B7)
Option 3 (Using excel table)
=SUMIF([Id], 1, [Value])
For more details please refer to: https://support.office.com/en-ie/article/sumif-function-169b8c99-c05c-4483-a712-1697a653039b
Is this what you're looking for?
=SUMPRODUCT((A1:A5=1)*B1:B5)
Taken from here: Sum values from multiple rows using vlookup or index/match functions
How it works:
An array formula is used to create an array of numbers that gets passed to the SUMPRODUCT formula.
The array formula processes A1 and B1 together, then A2 and B2 and so on... if A1 is equal to 1, B1 is added to the array.

Finding companies appearing with different IDs in MS Excel

I have 2 columns in my data:
A - each company's unique ID.
B - the company name that corresponds to the respective ID.
This type of data extends to 13,000 rows. For instance:
Col A Col B
12 Google Inc
12 The Google
14 Google
18 Amazon
18 Amazon
21 Amazon INC
18 Amazon
...
As you can see from the example above, the issue is that sometimes the company has a different ID appearing. Furthermore, although in all 3 cases, the company is still the same, the fact that they've been worded differently makes it hard to do an exact match.
My goal in this exercise is two-fold:
Find which companies have different IDs showing.
Identify the row at which this happens.
It would be cumbersome to go through all 13,000 rows. What Excel formulas would do the trick?
You could use pivot tables to count how many duplicates each name has.
I would also:
Order the list by column B.
Add a formula in column c that compares the formula row with the previous row.
For example consider a formula in row 5:
=IF(B4=B5,"Identical","Different")
You could build in more intelligence for example compare the first word in the name in row 5 to see if it is in the row 4 name. eg
=IF( iserror( find( LEFT(B5,FIND(" ",B5,1)-1) ,B4,1) )
,""
,"Similar")
You could combine the above tow into a single function, or may use both in different columns (which is easier)
PART 2:
The data must be ordered by column B!
So using the above logic to compare the IDs you should add another column (column F) with this formula
= find( LEFT(B5,FIND(" ",B5,1)-1) ,B4,1)
Then add another column (column G)
=IF(B4=B5
, B5
, IF( iserror(F5) )
,""
, F5 )
)
This results in a value in column G which is either the identical company name or the first word of a company that has a matching name.
You can then add another column (column H) which compares the id's of rows with the same IDs
=IF(F4=F5
, IF(A4<>A5, "Different IDS, "Ok IDs")
, "First row in company group"
)

Index/Match multiple columns in Excel

I have 2 sheets. Sheet 1 is set up similarly to:
Keyword Domain Rank
A Z 1
B Z 2
C Z 3
D Y 10
E Y 15
B Y 20
And sheet 2 is set up like:
Keyword (Domain Z) (Domain Y)
A 1 -
B 2 20
C 3 -
D - 10
I'm trying to have a formula that will compare the keywords in Sheet 2 with those in Sheet 1 and then return the rank that corresponds to the correct domain (that's specified in Sheet 2 for that column). I can't get any formula I use to evaluate. I've used 2 formulas so far:
=INDEX(Raw!$H$11:$H$322, MATCH(A3,IF(Raw!$D$11:$D$322=All!$B$2,Raw!$B$11:$B$322),0))
The above formula works, to a point. The problem is that it simple pulls the domain for the first instance of the keyword found, which doesn't always match the domain in the column of sheet 2. The second formula I've tried:
=INDEX(Raw!$H$11:$H$322, MATCH(B3,MATCH($C$2,Raw!$D$11:$D$322,0)))
To make the values appear in the Sheet 2 table, use the following formula:
=SUMPRODUCT(--($A$2:$A$7=E2),--($B$2:$B$7=$F$1),$C$2:$C$7)
This returns 0 for non-matches - you can either format the cells to display 0 how you want, or you can use the longer/uglier:
=IF(SUMPRODUCT(--($A$2:$A$7=E2),--($B$2:$B$7=$G$1),$C$2:$C$7)<>0,SUMPRODUCT(--($A$2:$A$7=E2),--($B$2:$B$7=$G$1),$C$2:$C$7),"-")
To calculate the rank on the first sheet based on the data from the second sheet:
=VLOOKUP(A2,$F$2:$H$5,MATCH(B2,$G$1:$H$1,0)+1,FALSE)
For sample purposes, this just put your sheet2 data in F1:H5.
This looks for the corresponding keyword and then uses match to pick the right column. I named the columns Z and Y, but if you need Domain included that can be done as well. Note that this causes an error since there is no E defined in your second table - is that the case? If so, it can be adjusted to account for no matches as follows (assuming Excel 2007):
=IFERROR(VLOOKUP(A6,$F$2:$H$5,MATCH(B6,$G$1:$H$1,0)+1,FALSE),"Rank Not Found")
You could also use PivotTable with Keywords in rows and Domain names in columns. It seems like that would do the job and be a more robust solution.

Resources