TheWennerWoman
Active Member
- Joined
- Aug 1, 2019
- Messages
- 270
- Office Version
- 365
- Platform
- Windows
Cells B4 and B5 on my worksheet allow the user to enter a year and period. So, typically they'll enter 2021 in B4 and 7 in B5 (relating to period 7 in 2021, i.e July).
I have this formula in B6;
which drives some SQL code in my macro. In the above example, 202107 is correctly returned.
However, if they enter 2021 in B4 and 10 in B5, my SQL code returns no data and I can see why - in B6, my formula isn't working, it's returning 2021010.
What am I doing wrong? it works for 1-9 but not 10 (and presumably 11 and 12)!!
I have this formula in B6;
Code:
=B4&IF(B5<"10","0"&B5,B5)
which drives some SQL code in my macro. In the above example, 202107 is correctly returned.
However, if they enter 2021 in B4 and 10 in B5, my SQL code returns no data and I can see why - in B6, my formula isn't working, it's returning 2021010.
What am I doing wrong? it works for 1-9 but not 10 (and presumably 11 and 12)!!