Excel check cell for string match against multiple other cells - excel

I have a sheet in which I need to check the value of a cell against all the values in a column in an external sheet and if it matches copy an earlier cell in the matched cells row.
This is perfect for a single cell check:
=IF(E2=(external.xlsx!D2),(external.xlsx!A2),"")
...but what if I want to check if E2 matches D2:D500 and if do copy A2:A500 respectively?
The data below may help to clarify:
MASTER SHEET
COLUMN E COLUMN F
2 - 0007597_halka_kamila.jpeg
3 - 0007597_halka_kamila.jpeg
4 - 0007597_halka_kamila.jpeg
5 - 0007715_komplet_elena.jpeg
6 - 0007715_komplet_elena.jpeg
7 - 0007715_komplet_elena.jpeg
8 - 0007913_podomka_erika.jpeg
9 - 0007913_podomka_erika.jpeg
EXTERNAL SHEET
COLUMN A COLUMN D
2 - HALKA KAMILA 0007597_halka_kamila.jpeg
3 - HALKA KAMILA 0007597_halka_kamila.jpeg
4 - HALKA KAMILA 0007597_halka_kamila.jpeg
5 - KOMPLET ELENA 0007715_komplet_elena.jpeg
6 - KOMPLET ELENA 0007715_komplet_elena.jpeg
7 - KOMPLET ELENA 0007715_komplet_elena.jpeg
8 - PODOMKA ERIKA 0007913_podomka_erika.jpeg
9 - PODOMKA ERIKA 0007913_podomka_erika.jpeg
So in the example above I need the formula in Master Sheet Column F2 to check for a match against every single cell in External Sheet Column D. If there is a match then the corresponding value from External Sheet Column A is copied to Master Sheet F2 which would hopefully give:
MASTER SHEET DESIRED RESULT
COLUMN E COLUMN F
2 - 0007597_halka_kamila.jpeg HALKA KAMILA
3 - 0007597_halka_kamila.jpeg HALKA KAMILA
4 - 0007597_halka_kamila.jpeg HALKA KAMILA
5 - 0007715_komplet_elena.jpeg KOMPLET ELENA
6 - 0007715_komplet_elena.jpeg KOMPLET ELENA
7 - 0007715_komplet_elena.jpeg KOMPLET ELENA
8 - 0007913_podomka_erika.jpeg PODOMKA ERIKA
9 - 0007913_podomka_erika.jpeg PODOMKA ERIKA
The objective is to then copy the formula so it can run against the 500 or so rows I have. Appreciate any advice and help.

Would a lookup work for you? The formula in G1 is
=IFERROR(INDEX($A$1:$A$10,MATCH(E1,$D$1:$D$10,0)),"")
copied down.
Edit: this is for the data as described in your edited question. Starting in F1 and copy down. If you start in F2, change the Match(E1.... to Match(E2....
=IFERROR(INDEX(external.xlsx!A:A,MATCH(E1,external.xlsx!D:D,0)),"not found")

Related

perform function on criteria in SUMIF function

I am writing a SUMIF function on a range with a format such as:
A B
1 1.1 5
2 1.2 5
3 1.3 5
4 2.1 5
5 2.2 5
I want the SUMIF to group values together by their integer, i.e.:
A B
1 1 15
2 2 10
I can do this by creating a third column C and applying INT(A) so that:
A B C
1 1.1 5 1
2 1.2 5 1
3 1.3 5 1
4 2.1 5 2
5 2.2 5 2
and (for 1)
=SUMIF(C:C, 1, B:B)
Is there a way to do this in one cell? i.e.
=SUMIF(A1:A5, "int(range) = 1", B1:B5)
I have also tried:
=SUMIF(A1:A5, "1*", B1:B5)
and
=SUMIF(A1:A5, 1&"*", B1:B5)
But these also do not work
You can use SUMPRODUCT e.g.
=SUMPRODUCT(--(INT($A$1:$A$5)=C1),$B$1:$B$5)
INT($A$1:$A$5)=C1 produces an array of TRUEs and FALSEs. The -- operator converts that to an array of 0s and 1s. Then you multiply by the values in B.
Formula in cell F12 is:
=SUMIFS($B$1:$B$5;$A$1:$A$5;">="&E12;$A$1:$A$5;"<"&E12+1)
Drag down
With Excel 365 you can do it like-
=LET(x,UNIQUE(INT(A1:A5)),y,SUMIFS(B1:B5,A1:A5,">="&x,A1:A5,"<"&x+1),CHOOSE({1,2},x,y))

How to retrieve a list of cells with a specific value from a column, and display the text content of another column into another sheet?

I have a spices "Inventory" sheet with Column A "Product" and Column B "Stock". I would like to retrieve the names of the spices from "Product" based on a certain stock value from "Stock", say 0, or any other criteria (<=5), and display the names of the pices from "Product" into another sheet.
A B
1 Product Stock
2 Cinnamon 3
3 Cassia 0
4 Fennel 1
5 Aniseed 0
6 Star Anise 0
7 Liquorice 1
8 Clove 7
9 Allspice 0
10 Vanilla 1
11 Tonka bean 1
I have tried a combination of INDEX MATCH and it does work partially but not in the concise and clean way I was expecting. THis is my formula so far:
=INDEX(Inventory!A2:A11,MATCH(0,Inventory!B2:B11,0))
And this is what I get when I drag the formula down to extend the selection:
D
1 No Stock Prods
2 Cassia
3 Cassia
4 Aniseed
5 Aniseed
6 Star Anise
7 Allspice
8 Allspice
9 Allspice
10 #N/A
11 #N/A
So it does bring those entries with value 0, but it keeps retrieving the same values as the formula moves down the sheet until it finds another match, and so on.
This is what I want, only the names of products with stock 0, without repeating names or errors:
D
1 No Stock Prods
2 Cassia
3 Aniseed
4 Star Anise
5 Allspice
To get the values equivalent to 0 in column B, in D1 enter:
=IFERROR(INDEX($A$1:$A$11,AGGREGATE(15,6,ROW($1:$999)/($B$1:$B$11=0),ROW(1:1)),),"")
and copy downward:
To use a different criteria, just replace the factor:
($B$1:$B$11=0)

Change cell reference when adding a new row in base sheet

I have 2 excel files: base sheet in the 1.xlsx with raw data and formula sheet for formulas in 2.xlsx
base file 1.xlsx:
1 - 1
2 - 2
3 - 3
4 - 4
5 - 5
formula sheet in 2.xlsx
1 - ='basesheet'!A1
2 - ='basesheet'!A2
3 - ='basesheet'!A3
4 - ='basesheet'!A4
5 - ='basesheet'!A5
Then I insert a new row in the base sheet 1.xlsx:
1 -
2 - 1
3 - 2
4 - 3
5 - 4
6 - 5
I want my cell references in the formula sheet in 2.xlsx updated, so I have
1 - ='basesheet'!A2
2 - ='basesheet'!A3
3 - ='basesheet'!A4
4 - ='basesheet'!A5
5 - ='basesheet'!A6
is it possible and how can I do that?
P.S. Data is very large, this is just a simple case
This already is an inbuilt feature in excel
EDIT: This applies not only to Worksheets but also to
Workbooks:

Copy&Paste Data Multiple Criteria Excel

I need to copy information from one table into another table and i am not sure how to do that.
So that would be my initial table:
Date 1 Date 2 Date 3
Part A 122 134 1212
Part B 453 3 4536
Part C 35 23 3
I need to copy that information into another table with different outline:
Part A Part B Part C
Info 1 - - -
Date1 Info 2 122 453
Info 3 - - -
Info 1 - - -
Date 2 Info 2 134 3
Info 3 - - -
Info 1 - - -
Date 3 Info 2 1212 4536
Info 3
How could i copy& paste the information into the new table?I think Index Match would work but not sure how.
Assuming you table starts from cell A1 as below,
Enter the formula in cell C2 as below,
=IF(MOD(ROW(),3)=0,OFFSET(Sheet5!$A$1,(COLUMN()-2),(ROW()/3)),"")
Drag it to the right and then down to complete the range. This formula refers Sheet5 which you can change it per your needs.

Find summation and count only if they are EQUAL in Excel

In EXCEL sheet I have 1728 rows and 2 columns (L and O). I am doing addition of these 2 columns in column P. Further I want to count the occurrence in this column if addition is EQUAL to 2 or 4 or 6 or 8 BUT condition here is that The COUNT should be such that BOTH the columns L and O are EQUAL and Their addition is either 2 or 4 or 6 or 8.
This means that only the columns in L and O with values "1+1" , "2+2", "3+3", "4+4" should be counted. The addition of "1+3", "4+2" should not be counted.
=COUNTIF(P:P,4)
does not work.
L O P M
===========================
1 1 2 1 (NO OF 2'S)
2 2 4 1 (NO OF 4'S)
3 3 6 1 (NO OF 6'S)
1 3 4* NO TO BE COUNTED
4 4 8 1 (NO OF 8'S)
2 4 6* NOT TO BE COUNTED
4 2 6*
AS SEEN ABOVE RESULT OF COUNTING IS STORED IN M. Let me know the formula
=IF(L29=M29,SUMPRODUCT(--($L$29:$L$35=$M$29:$M$35)*(L29=$L$29:$L$35)),"Not Counted")
My data started in row 29 so you will need to adjust the references. It counts the entire table in 1 shot. So if you added a row to the bottom that had 1 and 1 and 2, the results in column M in your first row would become 2 and the same for the row you just added.
Will this formula help...?
=IF(AND(A1=B1,OR(SUM(A1,B1)=2,SUM(A1,B1)=4,SUM(A1,B1)=6,SUM(A1,B1)=8)),SUM(A1,B1),"NOT TO BE COUNTED")
Just drag the formula till you have data. You will need to adjust the references.
Here is the reference data.

Resources