@raj99918 

so 3rd variable will be auto populated based on other 2 then you can have it as text type variable

Then use onChange + GlideAjax and handle the IF ELSE logic in script for different combinations and then return the value, then store in 3rd variable

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader