BethanyHudson
4 years agoQrew Trainee
If Formula Help with commas
I've got an If formula that is working, but I need to only have the first comma before the next line to show only if there is text in the next field. Here's my formula:
(If([Grant Acct.]<>"", [Grant Acct.]&"-"&If([GL Code]<>"", [GL Code]&"-"&If([Function Code]<>"", [Function Code]&"-"&If([Department Code]<>"", [Department Code]&"-"&If([Future Code]<>"", [Future Code]&",\n\n"&
(If([Grant Acct. 1]<>"", [Grant Acct. 1]&"-"&If([GL Code 1]<>"", [GL Code 1]&"-"&If([Function Code 1]<>"", [Function Code 1]&"-"&If([Department Code 1]<>"", [Department Code 1]&"-"&If([Future Code 1]<>"", [Future Code 1]&",\n\n"&
(If([Grant Acct. 2]<>"", [Grant Acct. 2]&"-"&If([GL Code 2]<>"", [GL Code 2]&"-"&If([Function Code 2]<>"", [Function Code 1]&"-"&If([Department Code 2]<>"", [Department Code 2]&"-"&If([Future Code 2]<>"", [Future Code 2]&",\n\n"&
(If([Grant Acct. 3]<>"", [Grant Acct. 3]&"-"&If([GL Code 3]<>"", [GL Code 3]&"-"&If([Function Code 3]<>"", [Function Code 1]&"-"&If([Department Code 3]<>"", [Department Code 3]&"-"&If([Future Code 3]<>"", [Future Code 3])&",\n\n"&
(If([Grant Acct. 4]<>"", [Grant Acct. 4]&"-"&If([GL Code 4]<>"", [GL Code 4]&"-"&If([Function Code 4]<>"", [Function Code 1]&"-"&If([Department Code 4]<>"", [Department Code 4]&"-"&If([Future Code 4]<>"", [Future Code 4])&",\n\n"&
(If([Grant Acct. 5]<>"", [Grant Acct. 5]&"-"&If([GL Code 5]<>"", [GL Code 5]&"-"&If([Function Code 5]<>"", [Function Code 1]&"-"&If([Department Code 5]<>"", [Department Code 5]&"-"&If([Future Code 5]<>"", [Future Code 5])&",\n\n"&
(If([Grant Acct. 6]<>"", [Grant Acct. 6]&"-"&If([GL Code 6]<>"", [GL Code 6]&"-"&If([Function Code 6]<>"", [Function Code 1]&"-"&If([Department Code 6]<>"", [Department Code 6]&"-"&If([Future Code 6]<>"", [Future Code 6])&""))))))))))))))))))))))))))))))))))))))
------------------------------
Bethany Hudson
Program Administrator
Mobile Bay National Estuary Program
Mobile AL
2514598870
------------------------------
(If([Grant Acct.]<>"", [Grant Acct.]&"-"&If([GL Code]<>"", [GL Code]&"-"&If([Function Code]<>"", [Function Code]&"-"&If([Department Code]<>"", [Department Code]&"-"&If([Future Code]<>"", [Future Code]&",\n\n"&
(If([Grant Acct. 1]<>"", [Grant Acct. 1]&"-"&If([GL Code 1]<>"", [GL Code 1]&"-"&If([Function Code 1]<>"", [Function Code 1]&"-"&If([Department Code 1]<>"", [Department Code 1]&"-"&If([Future Code 1]<>"", [Future Code 1]&",\n\n"&
(If([Grant Acct. 2]<>"", [Grant Acct. 2]&"-"&If([GL Code 2]<>"", [GL Code 2]&"-"&If([Function Code 2]<>"", [Function Code 1]&"-"&If([Department Code 2]<>"", [Department Code 2]&"-"&If([Future Code 2]<>"", [Future Code 2]&",\n\n"&
(If([Grant Acct. 3]<>"", [Grant Acct. 3]&"-"&If([GL Code 3]<>"", [GL Code 3]&"-"&If([Function Code 3]<>"", [Function Code 1]&"-"&If([Department Code 3]<>"", [Department Code 3]&"-"&If([Future Code 3]<>"", [Future Code 3])&",\n\n"&
(If([Grant Acct. 4]<>"", [Grant Acct. 4]&"-"&If([GL Code 4]<>"", [GL Code 4]&"-"&If([Function Code 4]<>"", [Function Code 1]&"-"&If([Department Code 4]<>"", [Department Code 4]&"-"&If([Future Code 4]<>"", [Future Code 4])&",\n\n"&
(If([Grant Acct. 5]<>"", [Grant Acct. 5]&"-"&If([GL Code 5]<>"", [GL Code 5]&"-"&If([Function Code 5]<>"", [Function Code 1]&"-"&If([Department Code 5]<>"", [Department Code 5]&"-"&If([Future Code 5]<>"", [Future Code 5])&",\n\n"&
(If([Grant Acct. 6]<>"", [Grant Acct. 6]&"-"&If([GL Code 6]<>"", [GL Code 6]&"-"&If([Function Code 6]<>"", [Function Code 1]&"-"&If([Department Code 6]<>"", [Department Code 6]&"-"&If([Future Code 6]<>"", [Future Code 6])&""))))))))))))))))))))))))))))))))))))))
------------------------------
Bethany Hudson
Program Administrator
Mobile Bay National Estuary Program
Mobile AL
2514598870
------------------------------