Is there a formula in excel to find if a two letters cell in row1 exist in row2 and 3? - excel

I have a sheet in excel with three rows and three columns. I am looking for a formula in excel to find if the letters in first row exists in two other rows (each cell has two letters). For example this is my data:
A | B | C
------+----+---
1. MN | MM | HO
2. NN | KM | JJ
3. LM | MM | KO
I want to have a formula to return number of cells that are not match for each row, in column D and highlight the cells in row 2 and/or three that not exists in row one.
For example in my data: The string in C1 is HO and we have O in C3 but we don't have H in C2. But for two other columns (A & B), one letter of row A1 (MN) is in row A2 (NN) and the other one in A3 (LM), so row 2 column C should highlighted in red and number of mismatch should be 1 in row2 column D.
Comparisons are made individually in each column and the sum of the cells that highlighted in red is written in column D of the corresponding row.
Any help would be greatly appreciated
Thanks in advance for your help.

Related

Get the column number of a search criteria in a defined range

I have the following Excel spreadsheet:
A B C D E F G H
1 Search Criteria: Prod.D
2 Column: 4
3 Prod.A Prod.B Prod.C Prod.D Prod.E
4
5
In Range D3:H4 I have Product A to Product E listed.
Now, I want to achieve that when I put a product name into Cell C1 I will get back the Column Number of the product in the range.
In the example above I want to search for Prod.D within the Range D3:H4 and therefore the result in Cell C2 should be 4 since the search criteria appears in the fourth column within the defined range.
What formula do I need to achieve this?
Try this formula in cell C2:
=MATCH(C1,D3:H3,0)

Index only cells in a column from another sheet if another cell in same row has a value greater than 0

So I have an example below of what I'm wanting to do.
Basically I need to Index Column B from Sheet 1 into Sheet 2 BUT ONLY if the values in Column W in Sheet 1 are greater than 0. If it's not then I don't want it to be included in. The only column to Index is B starting from row 5 to say 100. Same for Column W.
I was trying to do it myself as I found This which is very similar as what I'm wanting to do but I couldn't figure it out.
Sheet 1
Row# Column B | Column(s)… | Column W
=================================
5) Thing 1 | | 0
6) Thing 2 | | 3
7) Thing 3 | | 0
8) Thing 4 | | 1
Sheet 2
Row# Column B | Column C | Column D
=================================
5) Thing 2 | 3 |
6) Thing 4 | 1 |
7) | |
8) | |
EDIT #3
You can use either SMALL, LARGE function to return the values from Column B on your Sheet1.
Presume you have given the following names:
Sheet1ColB: Sheet1!B5:B100
Sheet1ColW: Sheet1!W5:W100
Here is the formula to be put in Cell B5 on your Sheet2. Please note it is an array formula so you need to press Ctrl+Shift+Enter to confirm.
{=IFERROR(INDEX(Sheet1ColB,SMALL(IF((Sheet1ColW>0)*(LEN(Sheet1ColW)>0),ROW(Sheet1ColW)),ROW()-4)-4),"")}
or
{=IFERROR(INDEX(Sheet1ColB,LARGE(IF((Sheet1ColW>0)*(LEN(Sheet1ColW)>0),ROW(Sheet1ColW)),ROW()-4)-4),"")}
You can then use INDEX+MATCH to return the value from Column W on your Sheet1 in Column C on your Sheet2:
=IFERROR(INDEX(Sheet1ColW,MATCH(B5,Sheet1ColB,0)),"")
In the above screen-shot Solution 2 is using AGGREGATE which follows the same logic as SMALL/LARGE.
As you can see the sample data has taken into account duplicated values in Sheet 1 Col W, blank cells in both Column W and Column B on Sheet1, and blank cells, negative value or 0 value in Column B only on Sheet1.
Cheers :)
Use AGGREGATE() formula to filter based on condition.
=IFERROR(INDEX($A$5:$A$8,AGGREGATE(15,6,(ROW($A$5:$A$8)-ROW($A$4))/($B$5:$B$8>0),ROW(1:1))),"")

Conditional subtraction from multiple cells

A |B |C |....|K |L |M |
Tom |0 | |....|Tom |Jim |Dave |
Jim |1000 | |....|15000|14000|12000|
Dave |3000 | |....| | | |
Using Google Sheets for this one. I would like the values in columns K, L, and M to read from column B, detect if the corresponding cell from A reads one of 'Tom', 'Jim', or 'Dave' for example, and then subtract the amount from the correct column to reduce a running total. I've had some trouble figuring it out and tried to use conditional formatting to solve it but can't seem to quite get there. Is there a formula I can use that will read column B and subtract the amount shown from the correct column based on the name in column A?
So to pseudo-code it:
read(column B cell);
if(column B cell - 1 column = "Tom")
{
column K - (value of column B cell)
}
else if(column B cell - 1 column = "Jim")
{
column L - (value of column B cell)
}
etc.
Is there a simple method I can use to generate this result? Also thought about changing the formatting of a cell based on the name in the cell next to it and subtracting the value of any cell with that colour but this becomes unwieldy if names are added. Any assistance would be greatly appreciated!
would there be a way to constrain the formula to a single cell so I can have the total in a single location rather than down the columns? My plan is to have the total boxes scroll with the sheet and always be visible.
Let's assume that Columns A and B continue on down the sheet, with further name + amount entries. You want to have a single row of balances for each of the people.
The balance is then some initial value less the sum of amounts for that person. Say the amounts you've shown in row 2 are the initial values; here's how you could have row 3 reflect the remaining balance for each person (This is for "Tom", copy for the others):
=K2-sumif($A$2:$B,"="&K$1,$B$2:$B)
Alternative solution
This doesn't do exactly what you want, but it is more appropriate for a running total scenario, so others may find it useful to adapt to ledgers, etc.
The IF() function can be used to decide whether or not a value in Column B applies to one of the "total" columns, K to M.
Use this formula in K3, copy to the rest of the range:
=K2-if($A2=K$1,$B2,0)
This example is in Google Sheets, but the same formula works in Excel and other "compatible" offerings.
What you do is put the formula in each column.
Column K subtracts value of column B if column A = "Tom"
Column L subtracts value of column B if column A = "Jim"
etc

Excel if vaules of 2 columns match then take the difference of another two columns

I have 4 columns of data. I want to match the values of two of the columns then if take the difference of two other columns if the first two match. So it's accounts and amounts.
Example. If col A matches Col C take the difference of Col B and Col D and Out it in Col E
Col A Col B Col C Col D Col E
1234 $100 1234 $100 $0
1235 $120 1235 $150 $-30
1236 $150 1237 $150
1238 $130
=IF(A1=B1,C1-D1,)
A1 and B1 are cell references to values you are comparing, and C1 and D1 are cell references to the values you are trying to take the difference of. If you'd like to have the cell be blank instead of 0, add "" after the last comma.
Assuming first data row to be A2:E2, Please put below mentioned formula in cell E2
=IF(A2=C2,B2-D2)
Similarly you can do reverse action by like if it is not then add them or put 0 or blank by "" or subtract B2 from D2 by below given options.
=IF(A2=C2,B2-D2,B2+D2)
=IF(A2=C2,B2-D2,0)
=IF(A2=C2,B2-D2,"")
=IF(A2=C2,B2-D2,D2-B2)
Hope this would help!

Find value in 2D array and return value in adjacent cell

**Sheet 1**
ColumnA B C D E F G H
------------------------------------------------------------
EURUSD 1.2765 1 ACCOUNT624 2 account125 1 account834
EURCAD 1.01 2 Account49 3 account45 2 account67
EURGBP 0.78 2 Account777 1 account45 2 account678
**Sheet 2**
ColumnA B C D
---------------------------------------
EURUSD 1.2765 Account 624 ?
EURUSD 1.2765 Account 125
EURUSD 1.2765 Account 834
EURCAD 1.01 Account49
EURCAD 1.01 Account45
In Sheet 1 above each row shows a currency trade and what quantity goes to each account.In Sheet 2 each row shows 1 account only. I would like to populate columnd D in sheet 2 with the quantites from sheet 1.
Breaking it up into steps, i would like to:
Find the price in Sheet2!B1 in sheet1
On the same row in sheet1, find the cell containing the same account as Sheet2!C1
Return value in cell to the left of cell with matching account
I have used index/match before but I can't get it to work for 2 dimensional arrays. Can anyone help with a formula? Thanks in advance!
It's not pretty, but using what you requested - to find the match based upon price in column B (I would say your safer bet would be to use the Currency conversion "EURUSD", for example, since what if 2 currencies have the same ocnversion rate??), paste this formula in cell D1 on your second sheet:
=OFFSET(Sheet1!$B$1,MATCH(B1,Sheet1!$B$1:$B$3,0)-1,MATCH(C1,OFFSET(Sheet1!$B$1,MATCH(B1,Sheet1!$B$1:$B$3,0)-1,0,1,10),0))
You can then drag it down / change ranges as needed.
(PS - I'm also assuming you made a mistake on sheet2 and that the account numbers will be typed the exact same in both sheets)

Resources