Below is a table, I am looking answer in using

**IIF vba function ,**trying to learn IIF

Criteria IF Range("A2") = Purchase

Amount B2 should be in Column E2.

OR

Criteria IF Range("A2") = Sales

Amount B2 should be in Column D2.

Below is a table , expected output is in Column D and E.

Book2 | |||||||
---|---|---|---|---|---|---|---|

A | B | C | D | E | |||

1 | Transaction Type | Amount | Credit | Debit | |||

2 | Purchase | 6000 | - | 6000 | |||

3 | Sales | 8000 | 8000 | - | |||

Sheet1 |

Thanks

mg