PDA

View Full Version : IF Statement that will assign account types based on "account number"



aladdin16
12-07-2014, 06:30 PM
Doing a project in excel. Cannot wrap my head around how to do this. I have financial data that has "account number" (ex. 1000, 1001, etc) in column 1, "account description" (cash, a/r) in column 2 and the account balance (8,794) in column 3.
Basically I want to know how I can construct an IF statement in VBA that says IF the value in column 1 is greater than 1000 but less than 1005 THEN assign it am "account type" value of "cash" in column 4 for all of the account numbers within this range.
Any input would be greatly appreciated!

Attached is the project.

12593

Furthermore, I need to populate the Balance Sheet in the balance sheet tab with the right values. Would it be possible to use SUM + Vlookup in order to populate the balance sheet with the correct values after assigning "account types" as they will match the balance sheet

SamT
12-08-2014, 04:55 AM
I can't open the workbook, but

VBA If Statement:

For Each Cel in Range("A:A")
If Cel > 1000 And Cel < 1005 Then Cel.Offset(0, 3) = "Cash"
Next Cel
You can do this manually by sorting Column A, then enter "Cash" in the Account Type column next to the first 1001 account, selecting from that cell down to the cell next to the last 1004 account and pressing Ctrl + D

For the Balance Sheet use Excel's SUMIF Function