How do I conditionally add a new line and tabs in Excel? -


i have list of values id, name, category, description , variable amount of keyword values; between 0 , 18 each row. want create list of values in form of:

(id, 'keyword') , (id, 'keyword') 

where list increments if there keyword go identifier. meant easy manual list sql insert statement.

i realize can use &char(9) inserting tabs , &char(10) inserting new lines, , sequence proper tabulation &char(10)&char(9)&char(9) each new entry.

=if(g2<>"",concatenate("(",a2,", '",upper(g2),"')"),"") &char(10)&char(9)&char(9)& if(h2<>"",concatenate("(",a2,", '",upper(h2),"')"),"") 

i've tried several different combinations such as:

=if(g2<>"",concatenate("(",a2,", '",upper(g2),"')"),"")+ if(h2<>"",char(10)&char(9)&char(9)&concatenate("(",a2,", '",upper(h2),"')"),"") 

and

=if(g2<>"",concatenate("(",a2,", '",upper(g2),"')",char(10),char(9),char(9)),"")+ if(h2<>"",concatenate("(",a2,", '",upper(h2),"')"),"") 

and

=if(g2<>"",concatenate("(",a2,", '",upper(g2),"')"),"")+ if(h2<>"",concatenate(char(10),char(9),char(9),"(",a2,", '",upper(h2),"')"),"") 

which give errors in calculation. has else been dying know how , had kind of frustration? have solution this?

i figured out within hour of posting, neglected post solution here in case else wanted know.

you have concatenate whole series of if blocks , add char(10) , char(9)s inner concatenate blocks, so:

=concatenate(if(g2<>"",concatenate("(",a2,", '",upper(g2),"')"),""), if(h2<>"",concatenate(char(10),char(9),char(9),"(",a2,", '",upper(h2),"')"),"")) 

thanks,

-c§


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -