# Help writing a IF formula

Solved/Closed
alex - Dec 10, 2015 at 11:49 AM
Blocked Profile - Dec 10, 2015 at 04:50 PM
Hello,

I need to write an IF formula for excel. Cell A2 will either say ''receive'' or ''deliver''.

This formula works IF(A2=''receive'',1,2); but it doesnt do everything i need.

If cell A2 is a "receive" then it should produce a "1", if it is a "deliver", it should produce a "2", if call A2 is anything else (other than ''receive'' or ''deliver'') it should produce an error message or turn the cell red possibly. Any help with this would be greatly appreciated.
Related:

## 1 response

Blocked Profile
Dec 10, 2015 at 04:50 PM
Ok the Syntax for the IF() formula is as follows:
`=IF(LOGIC_TEST,TRUE, FALSE)`

Apply that syntax to A2 in your sheet as in: =IF("testing 1",1,2)

If statements can BE NESTED. So you could test for a false as so:
`=If("testing 1",1,IF("Testing 2",2,0))`

NOW format the cell to change under CONDITIONAL FORMATTING!

Have FUN!

I have said it once, I will say it again. IT!