Concatenating different formats

High77

New Member
Joined
Jul 6, 2010
Messages
31
Office Version
  1. 365
  2. 2016
  3. 2010
  4. 2007
Platform
  1. Windows
Hi,

I have created the following table:

1645374842650.png


C2 looks for the last entry of that row.
D2 looks up the Header for the last entry on the row.
E2 is a concatentate of both, as a straight formula and is the column I'll be keeping. (I'll remove columns C & D later, as they were my test cells for the formula).

This works great for whenever the last entry on the row is dropdown text. However when it is a date is throws a wobbly and spits out a number see C2 and the 2nd part of E2.

I've found how to concatenate to "fix" it as a date, however in this particular instance, some times the information will be normal text and other times it will be a date.

Any ideas how to concatenate so that when it's text it shows correctly eg WWN, then when its a date show 14/3/20 format rather than 44592 format?

It it's not possible, I'll have to keep columns C & D and forget Concatenating.

Regards,

Dave
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
how does
=F2&" "&IF(ISNUMBER(G2),TEXT(G2,"DD/MM/YY"),G2)
work for you ?
may need to change the columns - as i did not use yours
B is the concatenation of F & G

Various.xlsx
ABCDEFG
1
2Fred 01/01/21Fred1/1/21
3fred johnfredjohn
4
Sheet12
Cell Formulas
RangeFormula
B2:B3B2=F2&" "&IF(ISNUMBER(G2),TEXT(G2,"DD/MM/YY"),G2)



Note: Images are difficult to see , and also requires that I input all the data myself, which is very time consuming.

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

XL2BB is an add-in used on this forum , see my signature or the menu in post to link to the full details
OR put the sample spreadsheet onto a share
I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.

Here is the link to XL2BB instructions

 
Upvote 0
I don't think that you need to test for a number?

22 02 21.xlsm
CDE
1
2Interview44592Interview 31/1/22
3ElementWWNElement WWN
Concat formats
Cell Formulas
RangeFormula
E2:E3E2=C2&" "&TEXT(D2,"D/M/YY")
 
Upvote 0
I am not sure this is any "better", but here is another way to write the formula Peter posted (same length but it eliminates one concatenation)...
Excel Formula:
=C2&TEXT(D2," D/M/YY;; @")
 
Upvote 0
Not by my count. ?
Hmm, I miscounted by one. Okay, now they are the same length:biggrin:...

=C2&TEXT(D2," D/M/YY; @")

but now I am confused. In my original formula, I meant to use 3 semi-colons, not 2, in order to put the space/at characters in the text portion of the format pattern, but it worked with only two semi-colons which meant it worked with the space/at characters in the "zero" position of the format pattern. Given that, I tried using only one semi-colon (the above formula)... and it worked!!! Why??? I know you can do something similar if you provide a conditional test in square brackets on the first term, but that is not being done here. Can you or do you know of any documentation that explains why the pattern I used above should work?
 
Upvote 0
how does
=F2&" "&IF(ISNUMBER(G2),TEXT(G2,"DD/MM/YY"),G2)
work for you ?
may need to change the columns - as i did not use yours
B is the concatenation of F & G

Various.xlsx
ABCDEFG
1
2Fred 01/01/21Fred1/1/21
3fred johnfredjohn
4
Sheet12
Cell Formulas
RangeFormula
B2:B3B2=F2&" "&IF(ISNUMBER(G2),TEXT(G2,"DD/MM/YY"),G2)



Note: Images are difficult to see , and also requires that I input all the data myself, which is very time consuming.

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

XL2BB is an add-in used on this forum , see my signature or the menu in post to link to the full details
OR put the sample spreadsheet onto a share
I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.

Here is the link to XL2BB instructions

That worked perfectly thank you very much.
 
Upvote 0
you are welcome, but i think you have better answers from other members
 
Upvote 0
I don't think that you need to test for a number?

22 02 21.xlsm
CDE
1
2Interview44592Interview 31/1/22
3ElementWWNElement WWN
Concat formats
Cell Formulas
RangeFormula
E2:E3E2=C2&" "&TEXT(D2,"D/M/YY")
etaf is indeed correct. Your solution is shorter and works really well. Thank you for your help. I really appreciate it.
 
Upvote 0

Forum statistics

Threads
1,215,796
Messages
6,126,964
Members
449,350
Latest member
Sylvine

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top