what the formula does is either directly get the (say) account numbers based on If Else condition or build it from scratch based on pattern matching.
for example if it is 20000 then 51-20-5200, same for 30000 -> 10-30-5300, 10032 -> 10-10-4125 and 10031 -> 10-10-4105. if all this does not work. then it goes and checks if A452 is empty then -> empty. If all this does not work, then it goes and does pattern matching based on certain conditions using INDEX() and MATCH() functions on "settings tab" coupled with "&" to concatenate "-" and construct the account numbers from scratch. Hope this helps.
=IF(D452=20000,"51-20-5200",
IF(D452=30000,"10-30-5300",
IF(D452=10032,"10-10-4125",
IF(D452=10031,"10-10-4105",
IF(A452="","",
IF(INDEX(settings!L:L,MATCH(D452,settings!I:I,0),1)="",INDEX(settings!B:B,MATCH(A452,settings!A:A,0),1),"31")
&"-"
&INDEX(settings!F:F,MATCH(B452,settings!E:E,0),1)
&"-"
&INDEX(settings!J:J,MATCH(D452,settings!I:I,0),1))))))
H2R