Concat Date As Text - excel-2007

I am attempting the following formula:
=concatenate(A1, " ", B1, " - ", C1)
Where column A is text, B and C are dates. The concatenate function returns the numerical value of the date, rather than the text value. How do I fix this?

You can use TEXT
=CONCATENATE(A1," ",TEXT(B1,"dd mmm yyyy")," - ",TEXT(C1,"dd/mm/yyyy"))

Related

Vlookup or Match by split function

I am working on a project in google sheets and I have tried to use INDEX, MATCH, SPLIT function to get the result in column B. It doesn't seems to work at all.
I have provided a screenshot below.
Match & Split
Column B is where it need to return the value from column D (Date) by matching in Column F (Desc.)
by separating the value of Column F by ","
The end result is shown below.
Match & Split1
If anyone can help would be highly appreciated.
Try below formula:
=QUERY($D$3:$F,"Select D where F like '%"&A3&"%'")

Sort strings alphabetically ignoring brackets

I have eight different variables that can have a value or no value. They look something like this:
A= "h"
B= "(z)"
C= "a"
D= ""
E= "[st]"
F= ""
G= "xx"
H= "(t)"
I need them all together in alphabetical order (must include the brackets):
Aim= "a,h,[st],(t),xx,(z)"
I know how to put them in one string and how to put the "," in the right place.
How do I put them in alphabetical order, while ignoring the brackets?
To exclude the emtpy values and add the commas I use for every value:
If IsEmpty(HH) = False Then HHH = HH.Value & ","
To put them together I use the "&" function
StrHoribez = BBB & CCC & DDD & EEE & FFF & GGG & HHH & III
To remove the last comma I use:
If Right$(StrHoribez, 1) = "," Then StrHoribez = Left$(StrHoribez, Len(StrHoribez) - 1)
The alphabetical sorting can happen in between any of these steps.
How can I approach this? Maybe something with an array but I have no experience using these.
Using Excel worksheet:
Put the values into column A
Put the clean values without brackets into column B
Sort on the values in column B
Retrieve the sorted values from column A including the brackets
Using two-dimensional array:
Put the values into arr(x, 0)
Put the clean values without brackets into arr(x, 1)
Sort on the clean values
Retrieve the sorted values from arr(x, 0) including the brackets
See this for multi-dimensional sorting:
Sorting a multidimensionnal array in VBA

Make VBA DateDif behave and round down like Excel DATEDIFF

DateDiff("m", "06/14/1982", "09,01,1982") = 3
A1 = 06/14/1982
A2 = 09/01/1982
=DATEDIF(A1, A2, "m") = 2
If I need DateDiff to round down like DATEDIF does, how do I accomplish this?
You can use the Evaluate function in VBA. However, when working with dates in this manner, you need to ensure that the value being seen by the formula is the number corresponding to the date, and not a VBA Date data type. If the date is stored in a worksheet cell, you would do something like:
Evaluate("DATEDIF(" & [a1].Value2 & "," & [a2].Value2 & ", ""m"")")
If the dates are stored as dates in VBA variables, then:
Evaluate("DATEDIF(" & CDbl(DT1) & "," & CDbl(DT2) & ", ""m"")")
= Application.WorksheetFunction.RoundDown(DateDiff("d", a1, a2) / 30, 0)

Matching 2 columns with 2 others columns to return a value from another column

I have an issue I'm trying to fix in excel.
I want to create an automation with the following logic:
-Lookup each value from column H and I
-If they match the values in column A and B respectively
-Return the value in C to column J.
** Basically, IF(((H=A) AND (I=B)) THEN (return C in J)) ****
How is that possible?
In J2:
=IF(AND(H2=A2, I2=B2), C2, "")
In J2 this array formula:
=INDEX($C$2:$C$100,MATCH(H2 & "|" & I2,$A$2:$A$100 & "|" & $B$2:$B$100,0))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly Excel will put {} around the formula.
So enter in J2. Hit Ctrl-Shift-Enter. Then copy down.

How to copy values from two cells and paste in another cell, while preserving the format of both cells?

I have two cells in my excel sheet, one cell contains string such as below:
Gross amount:
while the other cell has currency in euros, for instance:
223.463.687€
Now I want to copy both of these values, i.e. "Gross amount:" and "223.463.687€" and past it into a third cell. The formula that I am using is this:
=(A42&""&B42)
and I get the following result:
Gross Amount: 223463687,150838
But I should have:
Gross Amount: 223.463.687€
NOTE:
The format of currency is in German format, which means that "." (decimal point) and "," (coma) play the opposite roles. In German format, "," is the decimal point where as in English it is ".".
Try this:
=A1 & " " & TEXT(B1;"###.###€")
Edit: Interesting effect! 0 does not get interpreted as "0". Therefore little amendment, German notation (English would be If with , delimiter of course):
=A1 & " " & WENN(TEXT(B1;"###.###")="";"0 €";TEXT(B1;"###.###€"))