bv03a
bv03a

Reputation: 15

Excel How to extract two digits from Column A

I have a question about Excel How Can I extract two digits from Column B if Column B is empty extract two digits from column A. I know how to extract two digit from Column B but cannot understand how to do it if column B is empty.

for example: in column B in first row we have 123456 number we extract first 2 digits to column C, but in next row in column B is empty but column A is not empty and we need to extract number from column A.

Thanks for helping!

Upvotes: 0

Views: 271

Answers (2)

Terio
Terio

Reputation: 507

You must check the contents of the cells and extracts the digits if not blank

C2

=IF(B2="",IF(A2="","",LEFT(A2,2)),LEFT(B2,2))

Bye

Upvotes: 1

EmilioW
EmilioW

Reputation: 26

You have to use the =ISBLANK function along with an IF statement to check the specific column in B, if it is empty, take the value from A.

Upvotes: 1

Related Questions