Compare user input to two columns and return value from 3rd predefined column - excel

So I am trying to understand how to use excel to complete this exercise.
Basically, I have 4 columns (A, B, C, D). Looks like this:
A B C D E
CRT Carrot CRT CR
Apple Apple APL AP
Basically, I need to scan down column A and compare it to columns B & C. If the word in A matched either the full word in B or the three letter word in C, then I need to take the two-letter word in D and write it in column E.
I've managed to Use VLOOKUP to scan column A and column C and then append to E, however, I can't figure out how to have excel scan both B & C and then append D to E. (main issue here is that the input in A sometimes matches B and sometimes matched C).
Thanks!

I don't have a full grasp of your issue but have you tried aggregating the conditions in other columns like
Have column G Boolean check if A matches a word in B
Have column H Boolean check if A matches a three letter word in C
Have column I = G OR H
then have your result column based on I?

For what you are trying to achieve you can do with a nested if statement:
In Cell E1, use this fromula:
=IF(A1=B1,D1,IF(A1=C1,D1,""))
With the cell still selected, on the bottom right of the cell you will see a small square, click on this small square and drag down to auto-fill all the cells as required.

Formula: =IF(IFERROR(MATCH(A1,B1:C1,0),0)>0,D1,"")
Results:

Related

Formula to get crossed values

I am trying to get values from other column, based on some logic, crossed logic, but I didn't get any result with the only thing I know: IF or VLOOKUP.
The table is in this way:
So basically there are groups divided by blank row, and in column D I want to add the value from column B, but according with other letter that the one from the row ( C is from Credit, D is from Debtor). So in first D5 I have C on the same row in A5, so I need to take value from D, which is 2, according to B6.
So sorry if this question is too easy or stupid, but I don't know much about excel formulas, other that the basic one.
I'd say the fastest way with formula takes two columns. The first one (let's say column C) will use this formula to define the blocks:
=IF(A5="",C4+1,IFERROR(C4+0,0))
It's meant for cell C5.
The second column will give back the actual result:
=SUMIFS(B:B,A:A,IF(A5="C","D",IF(A5="D","C","")),C:C,C5)
It's meant for cell D5.
Place them accordingly and drag them down to cover your list.
Then again: if you are looking just for the number and not for its sum (and therefore assuming all numbers are equal for each letter in each block), just use this one in cell D5 instead of the previous one:
=SUMIFS(B:B,A:A,IF(A5="C","D",IF(A5="D","C","")),C:C,C5)/COUNTIFS(A:A,IF(A5="C","D",IF(A5="D","C","")),C:C,C5)
Now if you were to use only IF and VLOOKUP functions, a possible solution could be this one:
A
B
C
D
E
F
G
Block index
0
What to search
What is
Value
Result
C
1
=IF(A5="",C4+1,C4)
=IF(A5="",C4+1,C4)&SE(A5="C","D",SE(A5="D","C",""))
=C5&A5
=B5
=IF(VLOOKUP(D5,E:F,2,FALSO)=0,"",VLOOKUP(D5,E:F,2,FALSO))
D
2
=IF(A6="",C5+1,C5)
=IF(A6="",C5+1,C5)&SE(A6="C","D",SE(A6="D","C",""))
=C6&A6
=B6
=IF(VLOOKUP(D6,E:F,2,FALSO)=0,"",VLOOKUP(D6,E:F,2,FALSO))
D
2
=IF(A7="",C6+1,C6)
=IF(A7="",C6+1,C6)&SE(A7="C","D",SE(A7="D","C",""))
=C7&A7
=B7
=IF(VLOOKUP(D7,E:F,2,FALSO)=0,"",VLOOKUP(D7,E:F,2,FALSO))
=IF(A8="",C7+1,C7)
=IF(A8="",C7+1,C7)&SE(A8="C","D",SE(A8="D","C",""))
=C8&A8
=B8
=IF(VLOOKUP(D8,E:F,2,FALSO)=0,"",VLOOKUP(D8,E:F,2,FALSO))
D
3
=IF(A9="",C8+1,C8)
=IF(A9="",C8+1,C8)&SE(A9="C","D",SE(A9="D","C",""))
=C9&A9
=B9
=IF(VLOOKUP(D9,E:F,2,FALSO)=0,"",VLOOKUP(D9,E:F,2,FALSO))
C
4
=IF(A10="",C9+1,C9)
=IF(A10="",C9+1,C9)&SE(A10="C","D",SE(A10="D","C",""))
=C10&A10
=B10
=IF(VLOOKUP(D10,E:F,2,FALSO)=0,"",VLOOKUP(D10,E:F,2,FALSO))
=IF(A11="",C10+1,C10)
=IF(A11="",C10+1,C10)&SE(A11="C","D",SE(A11="D","C",""))
=C11&A11
=B11
=IF(VLOOKUP(D11,E:F,2,FALSO)=0,"",VLOOKUP(D11,E:F,2,FALSO))
D
2
=IF(A12="",C11+1,C11)
=IF(A12="",C11+1,C11)&SE(A12="C","D",SE(A12="D","C",""))
=C12&A12
=B12
=IF(VLOOKUP(D12,E:F,2,FALSO)=0,"",VLOOKUP(D12,E:F,2,FALSO))
C
5
=IF(A13="",C12+1,C12)
=IF(A13="",C12+1,C12)&SE(A13="C","D",SE(A13="D","C",""))
=C13&A13
=B13
=IF(VLOOKUP(D13,E:F,2,FALSO)=0,"",VLOOKUP(D13,E:F,2,FALSO))
C
5
=IF(A14="",C13+1,C13)
=IF(A14="",C13+1,C13)&SE(A14="C","D",SE(A14="D","C",""))
=C14&A14
=B14
=IF(VLOOKUP(D14,E:F,2,FALSO)=0,"",VLOOKUP(D14,E:F,2,FALSO))

Searching a column for a string in one array, and returning a value that corresponds to that array

I am going to do my best to describe this.
I want to search column C for any of the strings contained on a different sheet in column A, and if/when one of those strings is found, i want to return the column B that corresponds to the found string.
For example:
Sheet 1:
Column A
Column B
Column C
project 1
2/15/19
Status is Red, because....
Project 2
4/12/20
RAG- Green, PTG is....
And on another sheet I have common ways to describe their statuses in Column A, and in Column B, a simple letter R, A, G or NS (Not started) if no other common status is found.
Column A
Column B
Column C
Status is Red
R
Rag- Green
G
How can I Search Column C for a value on Column A (on a different sheet) and return column B in Column D on the original sheet?
Results should look like
Column A
Column B
Column C
Column D
project 1
2/15/19
Status is Red, because....
R
Project 2
4/12/20
RAG- Green, PTG is....
G
This may be a bit of an extended function and depends on how many rows you have in the second sheet.
You can hard code it with
=IF(ISNUMBER(SEARCH("Red",C2)),VLOOKUP("Status is Red",Sheet2!$A$2:$B$3,2,FALSE),IF(ISNUMBER(SEARCH("Green",C2)),VLOOKUP("RAG - Green",Sheet2!$A$2:$B$3,2,FALSE),"NS"))
Or use the more dynamic:
=IF(ISNUMBER(SEARCH(Sheet2!$A$2,Sheet1!C2)),VLOOKUP(Sheet2!$A$2,Sheet2!A2:B3,2,FALSE),IF(ISNUMBER(SEARCH(Sheet2!$A$3,Sheet1!C2)),VLOOKUP(Sheet2!$A$3,Sheet2!$A$2:$B$3,2,FALSE),"NS"))
Explanation
SEARCH(find_text,within_text) - returns the index of where the substring begins
ISNUMBER(value) - returns TRUE if a number, FALSE if not.
VLOOKUP(lookup_value,table_array,col_index_num,[range_lookup]) - finds the value within the array and returns the corresponding value in the specified column.
$X$Y - the dollar signs stop the values from changing when you use ctrl+d or ctrl+r to fill multiple cells
So to break it down:
IF (search returns an index)
THEN VLOOKUP (find this value and return the corresponding value from this column)
ELSE (repeat above as needed)
ELSE ("NS")

Excel - Extracting substring after a character contained in a string

I am trying to extract partial string contained within a cell after a certain character in the string.
I have a formula which can do this
=RIGHT(C10,LEN(C10)-SEARCH(":",C10))
But let's say the location of C10 cell isn't exactly known within the C column, and a way to locate it is by searching for a keyword in column D and then extracting the partial string using the above formula to a cell next to the keyword (column E).
I hope this makes sense.
Ex)
Column C
John: 1234 Alphabet Street
Claire: 3456 Diamond Street
Tim: 333 Laugh Lane
Bo: 5555 Great Neck Street
Grace: 777 Whiteside Blvd
Column D
John:
Claire:
Bo:
Thank you.
You could use:
=TRIM(SUBSTITUTE(VLOOKUP(D1&"*",C:C,1,0),D1,""))
This approach should work for you. First, modify the formula as below for the first row in E (i.e., E2)
=IF(ISTEXT(D2),RIGHT(C2,LEN(C2)-SEARCH(":",C2)),"No address found.")
In order to apply this formula throughout for the column triplets C, D and E do the following: Click on the top-left corner of column 'C', hold and drag the cursor towards right to include columns D and E and now drag all the way down to the last row of C, D and E. Now, the formula is automatically applied to all the rows viz. C, D and E.

Match value in column C to data in column A and return all data of column B

I have an Excel file with (for example) 4 columns and I want to search column A for a value mentioned in column C and show in column D all the results that were found in column B separated by a ; and a space.
I got this partly working with the following formula:
=IF(C3<>"";TEXTJOIN("; ";TRUE;IF(($A$2:$A$6=$C2);$B$2:$B$6;""));"")
The thing is, this formula doesn't show any results when the search criteria is not 100% matching.
The following doesn't work:
=IF(C2<>"";TEXTJOIN("; ";TRUE;IF(($A$2:$A$6=("*"&$C2));$B$2:$B$6;""));"")
Perhaps:
=IF(C2<>"";TEXTJOIN("; ";TRUE;IF(ISNUMBER(SEARCH($C2;$A$2:$A$6));$B$2:$B$6;""));"")

Is there a way to have column O pull values from column F is J through L match A through C

I have column A as city code, B as Origin City,St , C as city code, D as Destination city,St. I then similar date in I through L with Carriers that haul those lanes in N. If a row in the I through L match a row in A through D I need the value of F place in the O column in the corresponding row.
I am trying to paste an image of the Excel grid, but I need column O to pull the value from column F from the row that has the values from A to D that match the data in a row in I to L.
Expected Result in Grid
You can use a combination of index() with match()
So, to fill Column O, this should work:
=INDEX(F$40:F$60,MATCH(I40&K40,G$40:G$60,0))
I have assumed that you can add a helper column in G, which is =A40&C40 dragged down.
I have also assumed that the combination of the two numbers in cols A & C are unique when combined.
If that is not the case then you will need to add col B, so the helper column becomes =A4&B40&C40 and the match will be I40&J40&K40.
Tested this on 3 values, as you don't give data I can get to.

Resources