how can we search a number from multiple rows/columns in excel - excel

I have 3 columns. 3rd column is in sorted way which is numbers from 1 to 7.
2nd and 3rd column ares number between 0 to 9.
I want to search numbers in 3rd column between A1 to B7.
i have used the below formula to calculate the same and i am getting correct.
=IF(ISERROR(VLOOKUP(C1,A:A,1,FALSE)),IF(ISERROR(VLOOKUP(C1,B:B,1,FALSE)),"Not found","Found"),"Found")
However when am using full block(A1:B7) it is not working.
=IF(ISERROR(VLOOKUP(C2,$A$1:$B$7,1,FALSE)),"Not found","Found")
Considering N number of columns, how can we achieve the same.
2 7 1 Found
4 5 2 Found
6 4 3 Found
7 2 4 Found
2 1 5 Not found
3 9 6 Found
1 2 7 Found

Related

Excel formula to count how many times a part number is used in a top level assembly (no UNIQUE or FILTER)

I have a list of part numbers that are used in 4 different top level assemblies. The parts can be used in 1 to 4 of the top level assemblies. I'm trying to write a formula that will count how many unique top level assemblies a part number occurs in. I had previously written a formula that worked, but it uses UNIQUE and FILTER, and my coworkers don't have Excel 365, so those formulas aren't supported for them. I've been trying to come up with a workaround and would really appreciate any help :)
I have an example (I can't provide any real data) section of our spreadsheet and an image of the formula I had that was working
Top Level Assy
Part Number
Qty
Number of times used
02554
01622
4
3
89975
01622
4
3
95665
01622
4
3
98886
01723
4
1
98886
01723
10
1
98886
01723
4
1
02554
01734
4
3
89975
01734
4
3
95665
01734
4
3
02554
01740
6
3
89975
01740
6
3
95665
01740
6
3
02554
01746
5
3
89975
01746
5
3
95665
01746
5
3
02554
01835
2
3
89975
01835
2
3
95665
01835
2
3
02554
51205
4
3
=SUM(--(LEN(UNIQUE(FILTER(A:A, C:C=C2, "")))>0))
Picture of the excel sheet
Picture of working formula
Use the following formula in row 2: =SUMPRODUCT(--(FREQUENCY(IF($B$2:$B$20=$B2,$A$2:$A$20),$A$2:$A$20)>0))
*I think it doesn't require ctrl+shift-enter in older Excel versions, since SUMPRODUCT is an array formula by default.
The formula checks the frequency of values in column A where column B matches the value in the current row. It returns the count per unique value meeting the condition. Wrapping it in -- & >0 returns 1 for each unique value. SUMPRODUCT sums them.
Edit:
I realized that the top level assembly values are actual text, not numeric values. In that case (since it's all numeric values stored as text) you can use this workaround:
=SUMPRODUCT(--(FREQUENCY(IF($B$2:$B$20=$B2,--($A$2:$A$20)),--($A$2:$A$20))>0))
It converts the text to numbers.
Sidenotes to this workaround:
If any value would contain a character other than numeric it will not get counted.
If you have both values like 02554 and 2554 they'll both get converted to 2554 and counted likewise.
Edit 2:
For text use the following:
=SUMPRODUCT(IF($B$2:$B$20=$B2, 1/(COUNTIFS($B$2:$B$20, $B2, $A$2:$A$20, $A$2:$A$20)), 0))

Is there a way to find the closest row match based on a different row match?

I'm working with a data in which there are multiple sets of information in the same column. This is making it difficult to pick out the data I need as it always returns the first result. I am trying to find a way to ensure that the column result returned in a search is based on a different column's value. For example:
Name/Date
01/01/2022
02/01/2022
03/01/2022
04/01/2022
05/01/2022
Bob
1
7
2
6
1
Jane
1
7
9
3
1
Jimmy
8
7
5
4
2
Robin
1
2
9
6
2
Batman
4
7
6
6
8
06/01/2022
07/01/2022
08/01/2022
09/01/2022
10/01/2022
Bob
4
1
4
2
12
Jane
6
21
9
3
1
Jimmy
8
2
5
4
2
Robin
8
5
0
6
2
Batman
5
5
6
6
8
If I wanted to yield the number for Jane on 07/01/2022 (which is 21), is there any way of returning this? I've been able to use =MATCH to pull the correct column based on the date search criteria, but I cannot see a viable way of pulling for a particular person when their name appears multiple times in the same column. Attempting a lookup will return the first result for the name hit (so in the case of my Jane example, it would return row 3 instead of 9). I'm looking to be able to enter a name and a date, and it returns the result from that part of the array.
Is such a thing possible, please? If not, is there any workaround that may help to provide me the same result?
Thanks in advance for your assistance!
This is being attempting in Office 365.
Assuming:
ms365 (specifically access to the BETA-channel);
Equal intervals with the same names at the same postions;
Formula in I4:
=LET(X,WRAPCOLS(TOCOL(B1:F12,,1),6),SUM((A1:A6=I3)*FILTER(X,TAKE(X,1)=I2)))
Assuming your data starts in row 1
A1:F12 - data range
B17 - Jane
B18 - 07/01/2022
=LET(data,A1:F12,names,A1:A12,lookupname,B17,lookupdate,B18,INDEX(data,MIN(LET(rowlist,IF(names=lookupname,ROW(names),0),IF(rowlist>MAX(IF(data=lookupdate,ROW(data),0)),rowlist,""))),MAX(IF(data=lookupdate,COLUMN(data),0))))

Excel using SUMIF to calculate totals of multiple columns

I'm trying to use Excle's SUMIF to calculate totals of Col1 to Col5 for dates that are similar.
My formula is as follows =SUMIF($A2:$A7,A10,$B2:$F7), but this only gives me the total of a single column.
How can I get the Totals of all the columns based on the date like I've shown in my results.
Date Col 1 Col 2 Col 3 Col 4 Col 5
1/5/2017 1 2 2
1/5/2017 5 3 1
1/5/2017 9 5 5
2/5/2017 10 5 3
2/5/2017 20 10 3
2/5/2017 6 8 1 5
Desired Results
1/5/2017 15 7 7 3 1
2/5/2017 30 11 11 11 8
use below formula in cell B11
=SUMIF($A$2:$A$7,$A11,B$2:B$7)
Per the example you provided, One solution is to use SUMPRODUCT
Multiplies corresponding components in the given arrays, and returns the sum of those products
Microsoft Docs give a thorough example, but per SO etiquette, here is an example in case of link-rot: [FYI, I used absolute reference for easier filling across, arbitrary how you get it done though]
Forumlas shown:
Formula is kind of hard to see without clicking on image:
=SUMPRODUCT(($B$3:$B$8=$B$11)*C3:C8)
This basically breaks down like this, it searches the B:B column for a match, and it will naturally return a true or false for the match, or 0/1 counterparts, and multiplys that by the number found in the column to the right (C3:C8), so it will either be 1 * # = # or 0 * # = 0

vlookup with multiple resulting values

I have a table array that looks like this:
A B
1 2
1 3
1 9
2 3
2 4
2 11
2 23
2 56
3 7
4 13
My VLOOKUP formula is to check for 1 in column A and then return the corresponding B value. Is there anyway I can get all the values for 1? Currently it just returns back the last corresponding number for 1 i.e. 9 in column B.
You can Pivot that data, or you can try INDEX and MATCH together, perhaps even an IF command with it.

Compare multiple data from rows

I'm looking for a way to compare multiple rows with data to each other, trying to find the best possible match. Each number in every column must be an approximately match the other numbers in the same column.
Example:
Customer #1: 1 5 10 9 7 7 8 2 3
Customer #2: 10 5 9 3 5 7 4 3 2
Customer #3: 1 4 10 9 8 7 6 2 2
Customer #4: 9 5 6 7 2 1 10 5 6
In this example customer #1 and #3 is quite similar, and I need to find a way to highlight or sort the rows so I can easily find the best match.
I've tried using conditional formatting to highlight the numbers that are the similar, but that is quite confusing, because the amount of data is quite big.
Any ideas of how I could solve this?
Thanks!
The following formula entered in (say) L1 and pulled down gives the best match with the current row based on the sum of the absolute differences between corresponding cells:-
=MIN(IF(ROW($C$1:$K$4)<>ROW(),(MMULT(ABS($C1:$K1-$C$1:$K$4),TRANSPOSE(COLUMN($C$1:$K$4))^0))))
It is an array formula and must be entered with CtrlShiftEnter.
You can then sort on column L to bring the customers with lowest similarity scores to the top or use conditional formatting to highlight rows with a certain similarity value.
EDIT
If you wanted to penalise large differences in individual columns more heavily than small differences to try and avoid pairs of customers which are fairly similar except for having some columns very different, you could try something like the square of the differences:-
=MIN(IF(ROW($C$1:$K$4)<>ROW(),(MMULT(($C1:$K1-$C$1:$K$4)^2,TRANSPOSE(COLUMN($C$1:$K$4))^0))))
then the scores for your test data would come out as 7,127,7,127.
I'm assuming you want to compare customers 2-4 with customer 1 and that you are comparing only within each column. In this case, you could implement a 'scoring system' using multiple IFs. For example,:
A B C D E
1 Customer 1 1 1 2
2 Customer 2 1 2 2
3 Customer 3 0 1 0
you could use in E2
=if(B2=$B$1,1,0)+if(C2=$C$1,1,0)+if(D2=$D$1,1,0)
This will return a 'score' of 1 when you have a match and a 'score' of 0 when you don't. It then adds up the scores and your highest value will be your best match. Copying down would then give
A B C D E
1 Customer 1 1 1 2
2 Customer 2 1 2 2 2
3 Customer 3 0 1 0 1
so customer 2 is the best match.

Resources