Excel case insensitive sum product - excel

I am trying to do a sum product to compare a cell to a column in another sheet and bring the value in another column associated to the match.
Using :
=SUMPRODUCT(Item_mst!$H$1:$H$4,--(A1=Item_mst!$B$1:$B$4))
sheet 1
Item
A
1 aaa
2 bbb
3 ccc
Item_mst
Item Qty
B H
1 aaa 20
2 AAA 10
3 AAA 20
4 AAA 20
The above formula gives me aaa/AAA = 60 while the correct value answer I expect is 70. Its not picking up the item when the qty is different and the case doesnt match.

SUMIFS would be a better solution
But, to answer the actual Q, try
=SUMPRODUCT(Item_mst!$D$1:$D$4,--(LOWER(H1)=LOWER(Item_mst!$B$1:$B$4)))

Related

TEXTJOIN per table line based on heading

I need to create a string per row line that includes all elements that are present in that row but displaying the corresponding heading column text, while not representing (in the string) the element that is the label of the row. Explaining...
Consider the following table:
AAA
BBB
CCC
DDD
AAA
1
1
1
BBB
1
1
1
BBB
1
CCC
1
1
I expect the following result (for each table row):
Column A
BBB, DDD
AAA, CCC
DDD
Take notice that in the first row (which stand for element "AAA") that element does not appear in the string - same for "BBB" in the second line and "CCC" in the last line. For that same reason, the third line has an empty string as result.
In order to solve this, I'm creating a new table with each of the table heading element (that's not the row element) and then do a TEXTJOIN with ", " as separator. As follows:
AAA
BBB
CCC
DDD
AAA
BBB
DDD
=TEXTJOIN(", ";TRUE;B2:B5)
BBB
AAA
CCC
=TEXTJOIN(", ";TRUE;C2:C5)
BBB
=TEXTJOIN(", ";TRUE;D2:D5)
CCC
DDD
=TEXTJOIN(", ";TRUE;E2:E5)
Now, for sure it may be possible to do this without the need to create this extra table - or maybe to create such a table inline in the formula ?
You can use this formula:
=LET(
rH,B1:E1,
cH,A2:A5,
d,B2:E5,
BYROW(cH,LAMBDA(r,
TEXTJOIN(",",TRUE,
FILTER(rH,(rH<>r)*(CHOOSEROWS(d,ROW(r)-1)=1),"")
))))
It filters - per data-row - the header-row and returns only those values from the header row that don't match the rows first cell and have a 1 in the according column of the data row.
EDIT:
As per your comment - a one-liner that you have to drag down:
=LET(rH,$B$1:$E$1,cH,A2,d,B2:E2,
TEXTJOIN(",",TRUE,
FILTER(rH,(rH<>cH)*(d=1),"")
)
)
In this case you don't need the BYROW- part

How to check if value/string in one row of Table 1 is present in Table 2?

I want to check if a value or text string in a given row in Table 1 is also present in a given column in Table 2. Of course I could do this column by column in Table 1 but with about 50 columns I don't really want to. My data looks something like this:
Table 1
1 aaa bbb ccc
2 ddd eee fff
3 ggg hhh iii
Table 2
1 bbb
2 xxx
3 ccc
You could use an array formula:
=SUM(IF(COUNTIF(Sheet2!$A$1:$A$3,$A1:$C1)>0,1,0))
Press CTRL-SHIFT-ENTER after entering it as opposed to ENTER
This will tell you how many exist in the list on sheet2 for each row in sheet 1

Matching two columns and returning a third with data in between

I have tried using VLOOKUP, INDEX, and IF statements but none have quite worked.
What I want to do is match serial numbers and return a stock number, but there is data between the columns that I need to keep. Also there are only 60 serials that I am looking to link with stock numbers and 1200 serials with stocks to search through. So like this:
A B C D E F
1 description serial location Stock # Stock # Serial
2 info aaa 1 E1 zzz
3 info bbb 1 E2 sss
4 info ccc 2 E3 aaa
I am trying to put the formula in D, search and match column B with F and return column E to D.
Not exactly sure what is going on with the different quantities, but in D2 and copied down to suit:
=IFERROR(INDEX(E:E,MATCH(B:B,F:F,0)),"")
seems worth a try. VLOOKUP is not a good choice here, in part because the related field is to the left of the search term.

Find value from one cell, copy value from cell near to that cell and paste it to another sheet

I have 2 sheets with different values. I need to find a value from one cell.sheet1 in sheet2 and copy value from nextcell_in_the_same_row.sheet1 to nextcell_in_the_same_row.sheet2.
It is very difficult to explain let look at the example bellow.
E.g.
Before
first sheet:
A B
1 aaa 123
2 bbb 456
3 ccc 789
4 ddd 122
second sheet:
A B
1 aaa
2 ada
3 cca
4 ccc
After
first sheet:
A B
1 aaa 123
2 bbb 456
3 ccc 789
4 ddd 122
second sheet:
A B
1 aaa *need to find value in the first sheet and copy value from B2 because aaa in A1*
2 ada *value does not exist in the first sheet so copy nothing*
3 cca *not need to copy because no value in the first sheet*
4 ccc *need to copy the value from B3*
Thank you so much!
Use a VLOOKUP along with an IFERROR.
=IFERROR(VLOOKUP(A1, Sheet1!A:B, 2, 0), "")
This will do what you described (well described, by the way!) in your question. Drag the formula down in Sheet2 till the bottom.
VLOOKUP takes the value of A1 in sheet 2 (no sheet reference because the value is in the same sheet as the formula) and looks it up in column A of Sheet1.
It returns the second value (hence why 2) of the table selected in the formula (column A is 1, column B is 2).
The 0 tells the VLOOKUP to look for exact matches. You don't need approximate match here.
And IFFERROR is there in case VLOOKUP doesn't find anything (like with ada) and instead of giving #N/A, returns an empty cell, "".

How to fill cells from sheet A with values from sheet B when ID matches (in Excel)?

Consider the following 2 sheets. Sheet AAA has a list of companies with an emptry column ROA. Sheet BBB has a ROA value for some of these companies.
Sheet AAA
A B
1 ID ROA
2 1
3 2
4 3
5 4
Sheet BBB
A B
1 ID ROA
2 1 60.40
3 3 10.10
4 4 9.00
Looking at the ID in both sheets, I need a formula to fill in column AAA.B, resulting in
A B
1 ID ROA
2 1 60.40
3 2
4 3 10.10
5 4 9.00
What formula do I need in cell AAA.B2 (and down) to get this done? I believe VLOOKUP is the function appropriate here, but I am unsure as how to use it in this case?
Use the LOOKUP function with MATCH and ISNA:
=IF(ISNA(MATCH(A1,Sheet2!$A$1:$A$3,0)),"",LOOKUP(A1,Sheet2!$A$1:$A$3,Sheet2!$B$1:$B$3))

Resources