Comparing 2 columns to produce an answer for column 3 - excel

I need a formula, that looks for a number an entry in column A, then checks for yes or no (Y/N) in column B, and provides me with the answer from column C, the reason I require it is because whoever uses this sheet won't actually have access to the information (security reasons) so it will be in a hidden tab and this formula will be on a seperate sheet.
A B C
row 1 13 Y 10
row 2 15 Y 11
row 3 15 N 12
row 4 17 Y 13
So in the above example, i want to be able to look for 15 and N, and it provide me with 12
Im sure it's fairly straight forward for you guys but I'm getting nowhere, please let me know if you need any further information and I hope my formatting is okay!

This is just a case of a two column match. There are a few ways of performing this lookup; I prefer this standard formula method.
        
The formula in G2 is,
=IFERROR(INDEX(C$2:C$999, SMALL(INDEX(ROW($1:$998)+((A$2:A$999<>E$2)+(B$2:B$999<>F$2))*1E+99, , ), ROW(1:1))), "")
I've made that a bit more complicated than you requested. If you fill the formula down, you will receive successive matches (as per the modified data in the image above).

Related

Excel mapping and create a new column

Excel file columns:
A B C
2 two 3
5 five 8
3 three 10
8 eight 11
12 one 15
I want to create a new column Din same file like below:
A B C D
2 two 3 three
5 five 8 eight
3 three 10
8 eight 11
12 one 15
I want to map C and A and if there's a match D takes values of B.
Example: Value 3 in C is present in A, so D will take corresponding B value three.
Thanks!
So building on BigBen's additional suggestion of using an IFERROR, I believe you want something akin to this in Column D:
=IFERROR(VLOOKUP(C1, A:B, 2, FALSE), "")
... and then drag down the formula throughout Column D
Now, there are some assumptions being made here:
Your data does not have any header row, ala the data starts in Row 1, not Row 2
You want empty/blank values where there is no exact match (this is BigBen's IFERROR suggestion). Your current question layout seems to suggest this. Otherwise, you'll get #N/A in all those blank cells in Column D.
EDIT: To confirm, I used your data (though I started in Row 2), and here's how it looked after -
If one has DA-functionality you could use:
1) - Excluding empty cells using FILTER:
Formula in D1:
=FILTER(B1:B5,COUNTIF(C1:C5,A1:A5)>0)
2) - Including empty cells using XLOOKUP:
Formula in D1:
=XLOOKUP(C1:C5,A1:A5,B1:B5,"")
If one does not have access to DA-functionality you could use:
1) - Excluding empty cells using INDEX, MATCH and SMALL:
=IFERROR(INDEX(B$1:B$5,SMALL(IFNA(MATCH(C$1:C$5,A$1:A$5,0),""),ROW(A1))),"")
Note 1 - This needs to be array entered through CtrlShiftEnter
Note 2 - Alternatively, one could use a non-array entered approach including AGGREGATE as per #basic: =IFERROR(INDEX(B$1:B$5,AGGREGATE(15,6,MATCH(C$1:C$5,A$1:A$5,0),ROW(A1))),"")
2) - Including empty cells using VLOOKUP:
Please refer to the other answer given by #Gravity here.
Basically the difference between both approaches could be vizualised like:

Excel: Obtain a column by sorting anotr one values

I need to automatically obtain a sorted column of values from another given column values, like in the sample:
I have I need A unchanged, and also B obtained from A
A A B
-----------------
1 1 0
0 0 0
3 3 1
8 8 3
0 0 8
I mean if the values from A changes, the B should change accordignly...
Is that possible in MS Excel?
Here a sandbox and sample:
http://1drv.ms/1SkqMhS
If you put The formula =SMALL(A:A,ROW()) in B1 and copy down then the cells in B will be linked to the cells in A in such a way that the numbers in B will be the numbers in A in sorted order. This won't be efficient for larger ranges but will work fine for small to medium size ranges.
If you want the numbers to start in a lower row, say B2 because you have a header in B1, adjust ROW() to something like ROW()-1.
A word of warning: Use of ROW() can make a spreadsheet somewhat fragile in that formulas that involve it can change their meaning if rows are inserted or deleted or the block containing the formula is moved to somewhere else. Rather than using ROW(), there is something to be said for adding a helper column which numbers the data in A (which would then be in e.g. B) and referring to these numbers rather than small. For example, in:
If I put the formula
=SMALL($B$2:$B$5,A2)
In C1 and copy down, it works as intended. In response to a question you raised in the comments, I added still another column which gives an index where the corresponding value occurs. To do this I wrote in D2 (then copied) the formula
=MATCH(C2,$B$2:$B$5,0)
Of course. Highlight your range and in the Data tab, click "Sort", then you can choose how you want to sort your data:
If column B has information that is to be used with Column A (like next to A1 is "Car"), and you want to sort the whole table, based on Column A, then just select Columns A and B, then sort by column A.
Found the answer, thanks to John Coleman !
Just some minor details like cell value fixing (with $, like A$2)and the -1+ROW adjustment for the 1 header row!

Excel - Formula or Macro to fill a cell based on another cell that links to yet another cell

In Excel, I am trying to make a cell based of the values contained in two other cells.
I need Cells X and Y to have data based on Cells L and #, like so....
X Y L 1 2 3 4 5 6
A 6 1 1 6;1 6;1 7;1 7;2 7;2 8;1
B 7 2 4 6;1 6;1 7;1 7;2 7;2 8;1
So row A, has columns X and Y filled based of the values in the number columns. The specific number needed is what is filled in in column L.
I am not sure the best way to phrase this question. If my example doesn't make sense, I can try to clarify or provide more examples.
I have no idea if this can be done with fancy formulas or with a VBA macro or two. I am an excel noob.
If I've understood your question correctly you can do this with a combination of Left/Right, Index and search.
In my example images, the user inputs their value in column D, and then columns B and C use the formulea
=LEFT(INDEX($F2:$K2,1,$D2),(SEARCH(";",INDEX($F2:$K2,1,$D2))-1))
=RIGHT(INDEX($F2:$K2,1,$D2),(SEARCH(";",INDEX($F2:$K2,1,$D2))-1))
respectively
Here, the Index function returns the correct column to look at (i.e. the value chosen by the user, the Search function finds the position of the semi-colon, and the left/right functions return the values either side of the semi-colon.

In excel how do I reference the current row but a specific column?

Let's say I had the datasheet
A B C D
-----------
5 4 6 3
4 4 3 2
5 4 6 2
And I wanted to do something like
A B C D E F
----------------------------------------------
5 4 6 3 =AVERAGE(A1,C1) =AVERAGE(B1,D1)
4 4 3 2 =AVERAGE(A2,C2) =AVERAGE(B2,D2)
5 4 6 2 =AVERAGE(A3,C3) =AVERAGE(B3,D3)
So basically I want to make a formula that uses the current row but a specific column to find the average values. Is there a way to do this? Especially to automatic it down the entirety of each column (assuming all the columns are the same height)?
If you dont want to hard-code the cell addresses you can use the ROW() function.
eg: =AVERAGE(INDIRECT("A" & ROW()), INDIRECT("C" & ROW()))
Its probably not the best way to do it though! Using Auto-Fill and static columns like #JaiGovindani suggests would be much better.
To static either a row or a column, put a $ sign in front of it. So if you were to use the formula =AVERAGE($A1,$C1) and drag it down the entire sheet, A and C would remain static while the 1 would change to the current row
If you're on Windows, you can achieve the same thing by repeatedly pressing F4 while in the formula editing bar. The first F4 press will static both (it will turn A1 into $A$1), then just the row (A$1) then just the column ($A1)
Although technically with the formulas that you have, dragging down for the entirety of the column shouldn't be a problem without putting a $ sign in front of the column. Setting the column as static would only come into play if you're dragging ACROSS columns and want to keep using the same column, and setting the row as static would be for dragging down rows but wanting to use the same row.
Look at OFFSET(). My problem was to overcome row insertions.
I did the following:
=OFFSET(E774,-1,0)+OFFSET(E774,0,-1)-OFFSET(E774,0,-2)
This permits the Balance column to be above plus credit minus debit. I was hoping for an excel function to do this

Excel formula to look up and pick a value

I have a need to place an excel formula in Column-D. I am trying my best explain the need since I am not sure about how to explain this need.
The formula should search the Column-C value in the Column-A. When a match is found the corresponding Column B value should be placed in D.
Here is an axample of how the result should be.
Column-A Column-B Column-C Column-D
A 2 C =Formula should fill 9 over here.
B 5 A =Formula should fill 2 here.
C 9
D 12
VLookup should do what you need. Try
=VLOOKUP(C1, A$1:B$4, 2)
EDIT: Thinking about it, you'll want $ signs around your lookup array as it won't change when you copy the formula down.

Resources