I need a formula in Excel, not VBA please, forbidden to have such functions on my work machine. My situation is I need a number from cell A, which is a result from Today(), combined with a number from cell B, which is a result from Now(), combined with a number from cell C which is a text number, to output as a single number.
Example:
Cell A1 Cell A2 Cell A3
Formula: TODAY() NOW() 17709
Displays: 1011 1423 17709
Needed: 1011142317709
What I'm trying is this, which is a fail: =TEXT(O21,yy-mm)&""&TEXT(P21,hh,mm)&"""&VALUE(Q21)
=TEXT(O21,"yymm")&""&TEXT(P21,"hhmm")&""&VALUE(Q21)
Placed in quotes the number format and removed extra quote though not sure why you are adding null to the string.
To match the sample output OP provided the formula would be:
=TEXT(A1,"mmdd")&""&TEXT(B1,"hhmm")&VALUE(C1)
If you do not need leading zeroes to fill 5 digit placeholders for the value in Q21,
=TEXT(NOW(),"yymmhhmm")&TEXT(Q21, "0")
'possibly,
=TEXT(NOW(),"mmddhhmm")&TEXT(Q21, "0")
If you do need leading zeroes to fill 5 digit placeholders for the value in Q21,
=TEXT(NOW(),"yymmhhmm")&TEXT(Q21, "00000")
'possibly,
=TEXT(NOW(),"mmddhhmm")&TEXT(Q21, "00000")
Related
Lets say we have two cells A1 and A2:
A1: A, B, 13
A2: C,B,14
Which are Strings. I want to add the values at the end of each cell-string.
Hence what I do to extract a value of a specific cell:
=VALUE(RIGHT(A1, SEARCH(",",A1))))
Returns 13 as a VALUE (or int).
Now, is there a way to add A1 and A2 in a SUM function? I could not find a way to loop through each A cell in a SUM range and work the VALUE magic on it.
A very bothersome solution would be to add all the values together like so:
=SUM(VALUE(RIGHT(A1, SEARCH(",",A1))),VALUE(RIGHT(A2, SEARCH(",",A2))))
But that does not seem optimal. I tried around with IF but it seems that what I am missing is simply the While/For loop to iterate through a range.
With data in A1 through A10, pick a cell and enter:
=SUMPRODUCT(--(TRIM(MID(SUBSTITUTE(A1:A10,",",CHAR(1),2),FIND(CHAR(1),SUBSTITUTE(A1:A10,",",CHAR(1),2))+1,9999))))
The formula isolates the string after the second comma; converts it into an integer; and then sums the integers.
(just be sure that your SUMPRODUCT() covers only cells with data and not any blank cells)
EDIT#1:
a somewhat shorter formula is:
=SUMPRODUCT(--TRIM(RIGHT(SUBSTITUTE(A1:A10,",",REPT(" ",LEN(A1:A10))),LEN(A1:A10))))
EDIT#2:
The "shorter" formula works by replacing all commas with a great number of spaces, so many spaces in fact, that when we look at the RIGHT() part of the expanded string, all we see are spaces followed by some numbers. TRIM() removes these spaces, leaving us the numbers.
How can I make a cell A1 "1234" with cell A2 "27" to make 12340027 as a number not text. In short, numbers in A2 are 1, 2 or 3 digits in length but they must be formatted to 4 digits e.g. 27= 0027, 4=0004. Using TEXT is resulting in lookup functions not working
How about:
=A1*10^4+A2
Just adds 4 zeros to the end of A1 and then adds A2 to it.
#keatz also elegant answer
If I got you correctly,
you can achieve it by this formula:
=CONCATENATE(A2,RIGHT(B2/10000,4))*1
Wrap your formula in VALUE() to turn the text back to a number:
=VALUE(A1 & TEXT(A2,"0000"))
Or multiply the text by one (or add zero):
=(A1 & TEXT(A2,"0000"))*1
I have 3 names that I want to combine to create something unique - I've used "CONCATENATE", but to no avail.
Example:
Paper (will always be different)
000001 (This will be sequential, the next row will have 000002)
Plastic (will always be different)
Essentially I want to input all three items in different cells and have the fourth cell output the following:
Pa000001Pl
Thank you.
Using & between objects is an alternative way to concatenate in excel:
=LEFT(A1,2) & B1 & LEFT(C1,2)
See http://fiveminutelessons.com/learn-microsoft-excel/extract-text-cell-excel for info on how to extract text from cells. (Examples: LEFT(), RIGHT(), MID(),FIND().
See https://support.office.com/en-za/article/Combine-the-contents-of-multiple-cells-3a86c317-6b91-4f1d-8781-203320aefdce for info on how to combine text from cells.
If you want to keep the 00000's in the number you need to make sure to format the cells containing the numbers as Text.
You could do this using the TEXT() function on the fly:
=LEFT(A1,2) & TEXT(B1,"000000") & LEFT(C1,2)
The six 0's tell Excel to create a number 6 digits long and replace any 0 with a non-zero number from your cell. So if B1 is 1, TEXT(B1,"000000") will convert it to 000001. If B11 is 11, TEXT(B11,"000000") will convert it to 000011.
If you instead want to ensure that the same number of 0's remain in front of your non-zero numbers, you could use the CONCATENATE() function:
=LEFT(A1,2) & CONCATENATE(B1,"00000") & LEFT(C1,2)
This would always insert five 0's in front of whatever number is listed in B1.
With values in A1, B1, and C1, in another cell enter:
=LEFT(A1,2)&TEXT(B1,"00000")&LEFT(C1,2)
This is needed to preserve the leading zeros if those leading zeros are the result of formatting cell B1
Assuming your values are in the 2nd Row
=LEFT(A2,2) & B2 & LEFT(C2,2)
I have a little problem concerning comparing different cells together, that's I need to compare each cell in column A, versus the whole column B and get the specified found cell in the adjacent column c cell.
I used this equation:
=IF(ISERROR(MATCH(A61,B:B, 0)), "No Match", "Match on Row " & MATCH(A61,B:B, 0))
and this is the result:
18 001220 No Match
19 001221 No Match
20 001222 No Match
21 001223 No Match
22 001224 No Match
101264 00040 Match on Row 121
Note that all data types are stored as text. and this is mandatory.
The problem is that this formula skips some data and doesn't collect them from column b except when being changed from text to general or number, which will damage my worksheet, as many cells start with zeros.
If your lookup_value can be either text or a number but you are always looking for it as text, then format the lookup_value with a format mask that covers both scenarios. It seems that most of your sample data is six digits with leading zeroes if necessary so TEXT(A61, "000000;#") should work to leave text values alone and format numbers to text with a minimum of six digits with leading zeroes if necessary.The zeroes in front of the semi-colon format numbers as text; the # behind the semi-colon leaves text alone.
Excel 2007 can drastically shorten that formula with IFERROR by removing the redundancy.
For your sample formula that would make,
=IFERROR("Match on Row " & MATCH(TEXT(A61, "000000;#"), B:B, 0), "No Match")
Following is the which I am trying :
Let this number 6,123,456.33 in Cell A1,
Then in Cell B1 use this formula =TEXT(A1,"#,###,###.##"), will give you 6,123,456.33.
Then in Cell C1 use this formula = SUBSTITUTE(B1,",",".") ,will give you 6.123.456.33
Then in Cell D1 use this formula =","&RIGHT(H12,2), will give you ,33.
Then again come to Cell C1 Do text to columns or other options to remove the last digits with decimals and then concatenate result with Cell D1 shows the last three digits.
This tip will ends up in 6.123.456,33
But Problem is in point no. 5.
How should I remove .33 from cell C1?
TRUNC is not working on C1.
Any Suggestions ?
Seems like you don't mind having the result as text (and I can't seem to find a way to custom format it...) and as such, you can use the formula:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(A1,"#,###.00"),",","#"),".",","),"#",".")
There's a triple substitution, one to remove , for # (a dummy character), second to change . to ,, then last from the dummy # to ..
If A1 is always a 7 digit number with 2 decimals then you could use TEXT function like this:
=TEXT(A1*100,"0\.000\.000\,00")