excel vlookup with if functionc - excel

For example:
F2 = VLOOKUP($L$2,sheet2!$A$2:$G$169,6,0)
I would like to add in the function that if $L$2 can not be found in the sheet2!$A$2:$G$169, then show "invalid".
May i know how should i modified to code in excel? Thanks.

First test what gets returned if $L$2 cannot be found by putting in a value you know is not in the search set. For example if it returns 0 then:
=IF(VLOOKUP($L$2,sheet2!$A$2:$G$169,6,0) = 0, "invalid", VLOOKUP($L$2,sheet2!$A$2:$G$169,6,0))
If it returns an error then try something along the lines of
=IF(ISERROR(VLOOKUP($L$2,sheet2!$A$2:$G$169,6,0)), "invalid", VLOOKUP($L$2,sheet2!$A$2:$G$169,6,0))
or just
=IFERROR(VLOOKUP($L$2,sheet2!$A$2:$G$169,6,0), "invlaid")

Related

Wild card is not working for extracting status in excel

Below is my table, I want to extract status starting with "QATs" but the formula is not working.
CRM,QATsPending
PRM,QATSInprogress
CRM,QATsOnHold
CRM,QATsCompleted,Screen
My formula is working
=IF(G2="*Pending*", "QATsPending", IF(G2="*Completed*","QATsCompleted", IF(G2="*O2InProgress*", "QATsInProgress", "QATsOnHold")))
It is giving on QATsOnHold as output.
Your ELSE (, "QATsOnHold")))) is triggered for everything as no values in your Table actually EQUAL anything you are trying to match
You are also putting the value to match and the value to return in the wrong order.
It should be Match, Return, e.g. =IF(G2="QATsPending", "Pending"... not =IF(G2="Pending", "QATsPending"
Your code:
=IF(G2="Pending", "QATsPending", IF(G2="Completed","QATsCompleted", IF(G2="O2InProgress", "QATsInProgress", "QATsOnHold")))
Should be:
=IF(G2="QATsPending", "Pending", IF(G2="QATsCompleted","Completed", IF(G2="QATsInProgress", "O2InProgress", "QATsOnHold")))
But looking at your Table.. might actually be:
=IF(G2="QATsPending PRM", "Pending", IF(G2="QATsCompleted","Completed", IF(G2="QATSInprogress CRM", "O2InProgress", "QATsOnHold")))

Excel Len function based on condition

I have two columns in my excel file.
Full ID Expected Result
159473A1 159473
159696A1 159696
160614A1 160614
43293J1A 43293
43293D1A 43293
43293A2B 43293
43293J2B 43293
43293B2B 43293
What i had tried :
=Left(A2,LEN(A2)-2)
159473
159696
160614
43293J
43293D
43293A
43293J
43293B
53202
But has you can see, I cant do that because I still have some characters in the expected results
43293J
43293D
43293A
43293J
43293B
How can I get my expected results in like the top example?
In B2 try:
=LEFT(A2,MATCH(FALSE,INDEX(ISNUMBER(MID(A2,ROW(A$1:INDEX(A:A,LEN(A2))),1)*1),),0)-1)
If you have access to DA-functions (O365), like SEQUENCE:
=LEFT(A2,MATCH(FALSE,ISNUMBER(MID(A2,SEQUENCE(LEN(A2)),1)*1),0)-1)
Note: If you are dealing with integers too, maybe to prevent possible errors through MATCH, you could use =LEFT(A2,MATCH(FALSE,ISNUMBER(MID(A2&"A",SEQUENCE(LEN(A2)+1),1)*1),0)-1)
So, very simple in the first instance:
But you have an issue with line 4... so this will help that:
IF(ISNUMBER(VALUE(LEFT(A3,LEN(A3)-2))),VALUE(LEFT(A3,LEN(A3)-2)),VALUE(LEFT(A3,LEN(A3)-3)))
This formula will work for you , remember to click Ctrl+Shift+Enter after pasting formula as its a matrix based formula
mention your email i can send you my workout
=LEFT(A2,IFERROR(MATCH(1,ISERR(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)*1)*1,),)-1)

OR Formula in Word document not returning a value

I am working on a document where I need to be able to test multiple options in an if statement to see if one of them are true to decide if a paragraph displays on the document. I have been trying to figure out why my OR formula is not returning a value for me to test and I am not sure why it is not showing anything when it is updating.
I have inserted a field and added a formula within that field that I am hoping will work with my If statement to show the proper paragraph contens.
When I use an Or statement, even one as simple as { OR(1=1) } and update and toggle the field I get no result. From what I have read I should get a 1 or a 0, but I don't seem to get either of these results. The line just ends up blank. When I test it with my If formula it always shows the false result, even when the Or contains a true result.
The formula I am currently working with is:
{ IF{ OR("$event.eventType.name}" = "Birthday", "$event.eventType.name}" =
"Conference" } "Yes" "No" }
If I update and toggle the Or field it shows blank, no result either true or false, and makes the If formula show as false event on results where it should show true. As I mentioned above I even tried setting it to 1=1 and still could not get it to show as true. Not sure if there is something I am missing in working with the formula.
Any suggestions would be appreciated.
It's not clear from your post what $event.eventType.name is. Presumably it's a field generated by an Addin. In that case, you should be able to use something like:
{IF{={IF{$event.eventType.name}= "Birthday" 1 0}+{IF{$event.eventType.name}= "Conference" 1 0}# 0}> 0 "Yes" "No"}
or:
{={IF{$event.eventType.name}= "Birthday" 1 0}+{IF{$event.eventType.name}= "Conference" 1 0} \# "'Yes',,'No'"}
Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. The spaces represented in the field constructions are all required. If your fields are a kind of mergefield, you'll need to insert 'MERGEFIELD ' at the start of each one, thus:
{MERGEFIELD $event.eventType.name}

nested ifs with multiple sumifs based on changing criteria

I am having trouble with this formula and would like to know if I am even building it in the correct order or how i can change it to get the desired result. Getting formula missing an opening or closing parenthesis error:
=IF(BH2="PPD TO FSC",SUMIFS('ALL BIDS'!R:R,'ALL BIDS'!D:D,BV2,'ALL BIDS'!E:E,I2,'ALL BIDS'!W:W,'DC TOOL'!U2,'ALL BIDS'!G:G,'DC TOOL'!V2,'ALL BIDS'!H:H,'DC TOOL'!M2),SUMIFS(FREIGHT!Z:Z,FREIGHT!Q:Q,'DC TOOL'!F2,FREIGHT!M:M,H2,FREIGHT!O:O,"PPD",FREIGHT!AA:AA,GRIDS!$U$3),IF(BH2="PPD TO GDC",SUMIFS('ALL BIDS'!R:R,'ALL BIDS'!D:D,F2,'ALL BIDS'!E:E,I2,'ALL BIDS'!W:W,'DC TOOL'!U2,'ALL BIDS'!G:G,'DC TOOL'!V2,'ALL BIDS'!H:H,'DC TOOL'!M2),SUMIFS(FREIGHT!Z:Z,FREIGHT!Q:Q,'DC TOOL'!F2,FREIGHT!M:M,H2,FREIGHT!O:O,"PPD",FREIGHT!AA:AA,GRIDS!$U$3))
Looks like you want 3 different possible SUMIFS, with the logic being as follows:
IF BH2 = "x" SUMIFS1, IF BH2 = "y" SUMIFS2 else SUMIFS3 so you need to write that like this:
=IF(BH2="PPD TO FSC",SUMIFS('ALL BIDS'!R:R,'ALL BIDS'!D:D,BV2,'ALL BIDS'!E:E,I2,'ALL BIDS'!W:W,'DC TOOL'!U2,'ALL BIDS'!G:G,'DC TOOL'!V2,'ALL BIDS'!H:H,'DC TOOL'!M2),IF(BH2="PPD TO GDC",SUMIFS('ALL BIDS'!R:R,'ALL BIDS'!D:D,F2,'ALL BIDS'!E:E,I2,'ALL BIDS'!W:W,'DC TOOL'!U2,'ALL BIDS'!G:G,'DC TOOL'!V2,'ALL BIDS'!H:H,'DC TOOL'!M2),SUMIFS(FREIGHT!Z:Z,FREIGHT!Q:Q,'DC TOOL'!F2,FREIGHT!M:M,H2,FREIGHT!O:O,"PPD",FREIGHT!AA:AA,GRIDS!$U$3)))

IF, OR and IFERROR function in excel

Column_A Column_B New (Expecting result for this situation)
#N/A #N/A Manual Posting
My function has problem for the last syntax"IFERROR(IFERROR(....)" . Currently, I get #N/A for the "New" column. However, I want to get "Manual Posting" instead.
My syntax:
=IF(OR(IFERROR(B1,A1)="Bank BPH",IFERROR(B1,A1)="GE Budapest Bank"),"GECapital",IF(IFERROR(B1,A1)="Avio Aero","GE Aviation",IFERROR(IFERROR(B1,A1),"Manual Posting")))
Ok, working it out I think I can explain.
IFERROR(x,y) returns value x, unless it's an error, then it returns y .. (even if it is an error).
You then take result of that, and compare it to a string:
IFERROR(A1,B1)="Bank BPH"
Assuming valid values, that expression will, of course, return TRUE or FALSE.
If both A1 and B1 are error, however, what happens ??
What is the result of:
#ERR="string" ??
answer: an error ...
so what does the IF do with an error? it's neither true, nor false.
You can simplify the situation to just this expression to see what's going on:
=IFERROR(A1,B1)="Bank BPH"
it returns an error.
Neither true nor false.
You're going to need another check condition for an error and how to handle it ..
perhaps:
=IF(AND(ISERROR(A1),ISERROR(B1)), "Manual post", IFERROR(A1,B1)="Bank BPH")
might do the trick ??
I think I figure out the correct syntax. I used to put the "AND(ISERROR(B18),ISERROR(A18)),"Manual Posting" to the end. However, I moved it at the beginning, it seems the problem can be solved.
=IF(AND(ISERROR(B18),ISERROR(A18)),"Manual Posting",IF(OR(IFERROR(B18,A18)="Bank BPH",IFERROR(B18,A18)="GE Budapest Bank"),"GE Capital",IF(IFERROR(B18,A18)="Avio Aero","GE Aviation",IFERROR(B18,A18))))

Resources