Forum Discussion
AKuma0411
Jan 16, 2024Copper Contributor
Need help to build excel logic
Hi everyone,
just need some help on building logic in excel where it checks for following conditions and returns the output:
In the image as shown below, I want a logic in cell A2, which will check for conditions in cell B, C, D.
- if I have UCN 1256 in cell B2, facility in C2 as Unity, and Facility short as UN in cell D2, I want the formula in cell A2 to return 1256-Unity
- If I have UCN 1256 in cell B2, facility in C2 as "blank", and Facility short as UN in cell D2, I want the formula in cell A2 to return 1256-UN
- if I have UCN 1256 in cell B2, facility in C2 as Unity ,and Facility short as "blank" in cell D2, I want the formula in cell A2 to return 1256-Unity
By default, it should always pull UCN and long name, but in cases where we don't have the long name it should return UCN and short name. Also, when B,C,D are all blank it should just have "-" in cell A2.
This is the logic I tried so far-
=IF(AND(B2<>" ",C2<>" ",D2<>" "), B2 &"-"& C2,IF(C2<>" ", B2 &"-"&D2," "))
It seems to be working fine for first and third conditions but it's not working as expected for 2nd condition. pls see the image for reference
2 Replies
Sort By
- Detlef_LewinSilver Contributor
- AKuma0411Copper Contributorthank you so much! this is perfectly doing the job