Excel How to extract two digits from Column A

Viewed 25

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!

2 Answers

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.

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

Related