how to replace blanks with values from another column

Reply
Visitor

how to replace blanks with values from another column

Hi All,

 

I am trying to populate blank cell with a value from another column, i.e. 

 

if 'country' is blank then populate with a value from 'country_1'

 

I tried the below, but it doesn't seem to work. 

 

CASE

WHEN LENGTH(`Country`)=0
THEN `Country_1`

END

 

Please help!

 

Thanks

Max

Black Belt

Re: how to replace blanks with values from another column

IFNULL (`country`, `country_1`)

______________________________________________________________________________________________
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
______________________________________________________________________________________________
Purple Belt

Re: how to replace blanks with values from another column

The previously proposed formula will fix your issue, however if you need to use case statement (for another reason) the following should work I think

 

CASE

WHEN TRIM(`Country`) = ''
THEN `Country_1`

ELSE `Country`

END

Green Belt

Re: how to replace blanks with values from another column

might want to use a case statement for blanks and nulls.

 

 

Case when trim(`country`) = '' or `country` is null then `country` else `country` end

rahul
Announcements
Dojo Day is Coming! Mark your calendars for May 30th 0900-1700 MST Click here for more information