Converting Account Columns in Google Sheets

In my accounting spreadsheet, I have a column for accounts that records both debts and credits. I need help changing this single account column into two separate account columns. Specifically, if the voucher number equals 2, I want to retrieve the opposite value from column C. Conversely, if the voucher number is 3, the first account should be selected. I need a formula for column G that will yield the results I desire, as demonstrated in column H. Any assistance would be greatly appreciated.

You can achieve this by using the IF and VLOOKUP functions to differentiate between the voucher numbers in your data. Here’s a possible approach for column G:

Use the formula =IF(A2=2, VLOOKUP(2, A:C, 2, FALSE), IF(A2=3, VLOOKUP(3, A:C, 3, FALSE), "")). This will identify whether the voucher number in each row is 2 or 3, and retrieve the respective values from column C. Adjust the references as necessary to match your specific dataset. Remember to drag the formula down to apply it to other cells in column G.