What function can i use for my excel example? - excel

I have the next situation:
Column A - represent my values.
Column B,C,D - are values resulted from an vlookup formula.
What I need is:
I need to check if a value from A1 is found in B1 or C1 or D1 and if value is TRUE, i want to return A1 value in E1.
I tried with many functions but nothing helped me. My last try is with multiple vlookup functions but it doesn't work...
=VLOOKUP($A2,CHOOSE({1,2,3},$C$2:$C94319&$D$2:$D$94319&$E$2:$E$94319,$A$2:$A$94319),1,0)
Please Help me!
Thanks!

Here is the formula that you can use (assuming your data starts from row 1):
=IF(IFERROR(MATCH("*" & A1 & "*",B1:D1,0),FALSE), A1,"Not Found")

Related

COUNTIF cell description matches and within date range

Hi I am after some help with a COUNTIF formula, I want to add 1 to cell
if the 3 criteria are met (see image) =COUNTIF(K4:K20,D2 AND L4:L20,C6 AND M4:M20,B7) i can get the 2 count from =COUNTIF(K4:K20,D2) but the formula does not work with the AND L4:L20,C6 AND M4:M20,B7
Any help would be great
for first, I'd split your B column in two columns FROM and TO. This helps countifs to evaluate if time is after ( >= ) FROM and before (<) TO.
If you are asking what should you write in your C7 formula, this could be something like (according to columns in my screenshot):
=COUNTIFS(G:G,$C$5,H:H,">="&A6,H:H,"<"&B6,F:F,$B$2)
so use ">=" & cell to evaluate if time if after FROM columns; and "<" & cell to evaluate if is before TO column.
I paste this screenshot of I'd solve this problem:
screeshot
and here you have a working example

How to give reference to a row number in excel formula?

I need this formula: C(n) = B(n)*A5. (n is the row number)
Literally, multiply the current selected row number in column B with A5
I tried =ROW function for creating a reference but failed.
I tried with this formula: C(2) =MULTIPLY(B=ROW(),A5) thinking it will be parsed to C(2) =MULTIPLY(B2,A5)
You have two options to accomplish this:
1. INDEX() formula:
=INDEX(B:B,ROW())*A5
2. INDIRECT() formula:
=INDIRECT("B"&ROW())*A5
Where ROW() is the number of cell you're entering this formula into.
Found it.
=MULTIPLY(INDIRECT("F" & ROW()),INDIRECT(("G" & 2)))
INDIRECT(("G" & 2)) even makes it better if you want to drag and copy the functionality to all the rows below.

Excel If Then Formula

I'm currently have trouble with a formula. Essentially, I want a formula that will: 1) Check Column D to see if the returned value is "Yes". 2) If Yes, proceed to execute a LOOKUP formula. Here is the formula I have so far--unfortunately it's not working. Any help would be much appreciated!
=IF(D19<>YES, VLOOKUP(C19,'Workbench Exported List'!A2:A961, 'Workbench Exported List'!B2:B961), "Not Available")
A few issues with your formula as written:
Given that you want the VLOOKUP formula if col D = "Yes", your formula needs to be revised to use = rather than <>.
Text values (such as Yes) need to be enclosed in quotation marks when used in a formula ("Yes").
Your VLOOKUP() syntax is incorrect. You need to use VLOOKUP(value, array, column-number, TRUE/FALSE).
Without seeing your data, I'm assuming you want to look up the value in C19 in col A and return the value from col B. Try: =IF(D19="Yes", VLOOKUP(C19, 'Workbench Exported List'!A2:B961, 2, FALSE), "Not Available").
This will search for an exact match of the value in C19 in column 2 of 'Workbench Exported List'!A2:B961 (col B) if D19 is equal to Yes. If D19 is not equal to Yes, the formula will return Not Available.

EXCEL How do I ignore a cell if a cell has a value

I have a row that will have weekly values entered. Column B has the initial value, and E has the calculation; as I add values to C, D and so on, I want the calculation to skip the previous columns value when the next column gets a value.
B1-C1=E1 BUT when a value is added to D1, E1 would update to B1-D1=E1
Sorry for the horrible description. This is probably answered somewhere on this site but I am not sure what terms to search.
Many thanks!
you can use an if statement. I am not 100% sure of your problem but something like this might be helpful.
if(A1, A1, 0)
So for your example provided.
=B1-if(D1, D1, C1)
This says if there is a value in D1 use D1 else use C1. This works in this example, because if
D1 is empty or 0 you will use the other cell. This may change for any given problem.
Use this if function in E1:
=IF(D1>0,B1-D1,IF(C1>0,B1-C1,B1))
Then enter a value in B1, then C1 then D1 to see the results.
According to your question, you only have room for two entries after the default B1 value. This statement will handle that.
If you need more fields, nest more if functions. But if's can only be nested 7 deep, so you can only have an initial value in B1 and 7 more cells, C1 to I1 with your formula in J1
If you actual data is as simple as your sample data you could just use:
=IF(LEN(D2)>0, B2-D2,B2-C2)
You could also use:
=IF(ISBLANK(D2), B2-C2, B2-D2)
if you prefer but Len is a little shorter and I believe the ISBLANK() function has flaws, If you have a formula in D2 that has a calculation and you set the result to "" then it will pick up as false. It depends on your needs.
I would do the following.
In E1 paste the following:
=A1-INDEX(B1:D1,1,COUNT(B1:D1))
The count formula will tell how many values are present in the range of B:D column. This will be used to catch the last column with an index formula which will be deducted form A1.
One thing is very important! The values from A to D has to be written in sequence, if one column is missing than the calculation will be false.
Hope I could help!

Excel INDEX and MATCH Get Value

I have an excel workbook that I need some help with INDEX and MATCH or any other Formula that can get me my end result.
Here is sheet1:
SIT_ID METER SUSE_CD
10834282 DT0061 B
10834282 AW7931 P
21676286 CQ9635 P
21676286 DP4838 B
21726281 AW7880 P
21726281 DT0032 B
Here is Sheet2:
Site ID B P
10834282
21676286
21726281
Ultimately what I am trying to do is on Sheet2 is put the Meter that = B for the SITEID in the column and then Put the Meter that = P in the Same row.
I have never used Index or Match and I looked it up online but I am confused and hoping someone can help me with the correct formula or point me in the right direction.
Thanks so much!
INDEX first takes a range, then a row number, an optional column number (and an optional area number).
MATCH takes a value to lookup, an array and a mode.
In your problem you can use the following in Sheet2 cell B2:
=INDEX(Sheet1!$B$2:$B$7, MATCH($A2, IF(Sheet1!$C$2:$C$7=B$1,Sheet1!$A$2:$A$7), 0))
This formula is an array formula and will work with Ctrl+Shift+Enter and then you can fill it to the other cells.
I had to use an IF because there're two conditions to check.
EDIT: Use this one if your cell formats are different:
=INDEX(Sheet1!$B$2:$B$7,MATCH($A2*1,IF(Sheet1!$C$2:$C$7=B$1,Sheet1!$A$2:$A$7*1),0))
EDIT2: Adding trimming:
=INDEX(Sheet1!$B$2:$B$7,MATCH($A2*1,IF(TRIM(Sheet1!$C$2:$C$7)=TRIM(B$1),Sheet1!$A$2:$A$7*1),0))
EDIT3: If you're using it on your full data, change the range:
=INDEX(Sheet1!$B:$B,MATCH($A2*1,IF(TRIM(Sheet1!$C:$C)=TRIM(B$1),Sheet1!$A:$A*1),0))
Assuming your Sheet1 looks like this:
And your Sheet2 looks like this:
The formula in Sheet2 cell B2 and copied over and down to cell C4 is:
=INDEX(Sheet1!$B$2:$B$7,MATCH(1,INDEX((Sheet1!$A$2:$A$7=$A2)*(Sheet1!$C$2:$C$7=B$1),),0))
Note that this is a regular formula, so no need for Ctrl+Shift+Enter
A helper column D is added to initial columns.
D2: =$A2 & $C2
Now it's possible to make a simple search of the concatenated SITE_ID and SUSE_CD:
H2: =MATCH($G2&" B";$D$2:$D$8;0)
The result would be a row number (=1 in this case) for the needed string in array $D$2:$D$8.
INDEX shows the value of the cell, found by counting n-th row (defined by MATCH) and m-th column (=2) in array $A2:$A$8 from the upper left cell (A2).
Altogether: =INDEX($A$2:$B$8;MATCH($G2&" B";$D$2:$D$8;0);2)
The easiest way to get around with this is,
to use concatenation operator in the match function.
Don't forget to use Ctrl+Shift+Enter
Use below formula in column B of Sheet 2
{=INDEX(Sheet1!$B:$B,MATCH(Sheet2!$A2&Sheet2!$B$1,Sheet1!$A:$A&Sheet1!$C:$C,0))}
And the below formula in column C of Sheet 2
{=INDEX(Sheet1!$B:$B,MATCH(Sheet2!$A2&Sheet2!$C$1,Sheet1!$A:$A&Sheet1!$C:$C,0))}
And then flash fill the remaining rows.

Resources