## Combine multiple if statements into one

This is probably a simple solution but I am having trouble getting anything to work. Might just be the syntax.

Basically I want to merge these together so that one message box will pop up instead of 5.

If Me.Status_Mfg_Engineer <> "Approved" Then MsgBox "MFG Engineer has not approved" If Me.Status_Quality <> "Approved" Then MsgBox "Quality has not approved" If Me.Status_Production <> "Approved" Then MsgBox "Production has not approved" If Me.Status_Product_Engineer <> "Approved" Then MsgBox "Product Engineer has not approved" If Me.Status_Other <> "Approved" Then MsgBox "Other has not approved"

You want a single message box which summarises which agents have not approved.

Dim myPrompt as string myPrompt=vbnullstring If Me.Status_Mfg_Engineer <> "Approved" Then myPrompt= "MFG Engineer has not approved" If Me.Status_Quality <> "Approved" Then myPrompt=myPrompt & vbcrlf & "Quality has not approved" If Me.Status_Production <> "Approved" Then myPrompt=myPrompt & vbcrlf & "Production has not approved" If Me.Status_Product_Engineer <> "Approved" Then myPrompt=myPrompt & vbcrlf & "Product Engineer has not approved" If Me.Status_Other <> "Approved" Then myPrompt=myPrompt & vbcrlf & "Other has not approved" MsgBox _ Title:="Missing approvals", _ Prompt:=myPrompt, _ Buttons:=vbOkOnly

**Excel IF statement with multiple AND/OR conditions, nested IF ,** Once again, you could combine all of these into a single formula if you want. The only shortcoming of this approach is the need for the two tables for Sales and How to combine multiple if statements into one. Ask Question Asked 3 years, 2 months ago. Active 3 years, 2 months ago. Viewed 93 times -2. 1. I want it to

You can do this with `If.. ElseIf .. Else`

If Me.Status_Mfg_Engineer <> "Approved" Then MsgBox "MFG Engineer has not approved" ElseIf Me.Status_Quality <> "Approved" Then MsgBox "Quality has not approved" ElseIf Me.Status_Production <> "Approved" Then MsgBox "Production has not approved" ElseIf Me.Status_Product_Engineer <> "Approved" Then MsgBox "Product Engineer has not approved" ElseIf Me.Status_Other <> "Approved" Then MsgBox "Other has not approved" End If

Edit 2: Ah yes (@June7) - according to docs here

**Excel Nested IF statements,** If you need to test for more than one condition, then take one of several actions, depending on the result of the tests, you can nest multiple IF statements together in The crux of both of the functions is IF function can test only one condition at a time. And, OR function can test multiple conditions but only return true/false. And, if we combine these two functions we can test multiple conditions with OR & return a specific value with IF. How IF and OR functions Work?

If you want to test all items then issue a single composite message, consider:

Dim strMsg As String If Me.Status_Mfg_Engineer <> "Approved" Then strMsg = "MFG Engineer" & vbCrLf If Me.Status_Quality <> "Approved" Then strMsg = strMsg & "Quality" & vbCrLf If Me.Status_Production <> "Approved" Then strMsg = strMsg & "Production" & vbCrLf If Me.Status_Product_Engineer <> "Approved" Then strMsg = strMsg & "Product Engineer" & vbCrLf If Me.Status_Other <> "Approved" Then strMsg = strMsg & "Other" & vbCrLf If strMsg <> "" Then MsgBox "Items not approved: " & vbCrLf & strMsg

**IF function – nested formulas and avoiding pitfalls,** To evaluate several options with a nested IF statement, one approach is to use a tests, and you can combine the AND function with the OR function if needed. The term nesting means combining formulas together (one inside the other). By doing so, one formula will handle the outcome of another formula. When we talk of simple nested if, then it means one If Statement appears inside the other if statement. Take the above dataset.

**Using multiple IF statements in Excel. Learn Microsoft Excel,** One Excel function that I use quite a bit in my formulas is the IF function. We can combine multiple IF functions within the same cell, which is I need to Combine about 5 IF statements in Excel, but have no idea how to do it. I can do one If statements with 2 outcomes based on true or false, but I cant go further than that, Can someone help? (Here’s what I need) IF (A1 = “A”;A2*B1;(A1=“B”;A2*B2 and so on and so forth.

**Excel formula: Nested IF function example,** I've written four if statements that perform certain tasks based on the criteria. I'd like it to all be one statement that I can put into one of my cells, If you need to test for more than one condition, then take one of several actions, depending on the result of the tests, you can nest multiple IF statements together in one formula. You'll often hear this referred to as "nested IFs". The idea of nesting comes from embedding or "nesting" one IF function inside another

**Excel formula: Nested IF with multiple AND,** When you combine each one of them with an IF statement, they read like this: AND – =IF(AND(Something is True, Something else is True), Value if True, Value if Excel IF statement with multiple AND/OR conditions, nested IF formulas, and more by Svetlana Cheusheva | updated on November 12, 2019 2,434 Comments In Part 1 of our Excel IF function tutorial , we started to learn the nuts and bolts of the Excel IF function.