putexcel using R1C1 notation - reference

As from the official documentation of Stata "putexcel" procedure uses standard excel cell notation i.e. D25 instead of R25C4. If I only know column number is it possible to convert it to letters in my script?
Or is it possible to increment column names?

There is an undocumented Mata function numtobase26() that converts column numbers to Excel's column letters. For example, if you want to know what the 27th column will be called in Excel you can type in Stata:
. mata : numtobase26(27)
AA

Related

Excel: Text to number

I have had some numbers read into Excel from an external program. These numbers are currently formatted as text (column J). I would like to convert these numbers from text format to number format (decimal) as shown in column K as an example. I have already tried different possibilities (e.g. using the function "Text in Columns" and "Custom Formatting") but so far it has not worked. Can anyone help me?
Another way - use Data | Text to columns. Accept the defaults and change the destination to column K:
Or click on the down arrow next to the error symbol and select Convert to Number to convert in-place.
Use value function
like this in the formula bar
=value(jn)
note: n is the row number in which your values are present
Had same problem.
=VALUE(J1) or =VALUE(J1)*1 could help
also =CONCAT("0";J1) and then remove 0 (lil complicated, but worked)

How to Use Excel SUMIFS with Greater Than Or Equal Operator When Numbers Stored as Text

I have a table where underlying database stores numbers as text. In this case, the greater than or equal operator doesn't capture the first value.
This formula ignores the first row of the data in the result where AcctNum=123. The formuula returns 11 when it should return 21.
=SUMIFS(Table1[Balance],Table1[AcctNum],">='123'", Table1[AcctNum],"<='500'")
Things I have tried:
1. "*" wildcard.
2. Many combinations of T() and TEXT() Function.
Things I don't want to do:
1. Use arrays.
2. Add columns to my table that are converted to numeric, because not all AcctNum's are formatted the same way, which is why they must remain text.
3. Use SUMPRODUCT because readability of formula is important in this case.
I have written a custom function to work around the problem, but I would like to know if there is a natural Excel solution. I have read SUMIF and SUMIFS do not work well when numbers are stored or retrieved from database as text. I am using Excel 2016.
Try SUMPRODUCT with double minuses to convert the text and booleans to numbers.
=SUMPRODUCT(--(--Table1[acctnum]>=123), --(--Table1[acctnum]<500), Table1[balance])
What do you mean by 2. Add columns to my table that are converted to numeric, because not all AcctNum's are formatted the same way, which is why they must remain text?
You can do this with an array or a helper column, other than that, not sure if it's possible using SUMIFS.
If you use Sumproduct, you can explicitly convert the text to numbers.
=SUMPRODUCT(Table1[Balance],--(Table1[AcctNum]+0>=123),--(Table1[AcctNum]+0<=500))

Make SumIf ignore words?

=SUMIF(E3:E,"YES",C3:C)
The above formula works in adding the numbers in C if the corresponding E cell is "YES", however my cells in C have "# MINS" in them, is there a way to make SumIf ignore words and only add the number?
SCREENSHOT OF SPREADSHEET: https://cdn.discordapp.com/attachments/358381825246101505/488443165364322327/Screenshot_1.png
If you’re using Google Spreadsheets, you have the possibility to format the numbers as you want.
In the cells, store the numbers only so that SUMIF will work, then create a custom number format: in the toolbar - Format - Number - More Formats - Custom number format - type in # “MINS”.
=SUMPRODUCT(LEFT(C3:C5,LEN(C3:C5)-LEN(" mins"))*(D3:D5="yes"))
This is an array like calculation. As such full column references may bog your computer down with excess calculations.
Get rid of the MINS. You can use Find & Replace or Text to Columns, etc.
Create a custom number format of 0 \M\I\N\S.
Use your original formula.
excel
=SUMIF(E:E,"YES",C:C)
google-spreadsheet
=SUMIF(E3:E,"YES",C3:C)
Shareable link

How to convert Text to numbers in Excel 2010?

I want to convert the numbers from text format to numbers so tha i can make the average or sum of the whole columns.
I tried all the possible ways asfar as i read in many blogs, but nothing works.
There is no Green mark on the cell nor a quote '
Tried copying an empty cell and select required cells and paste special methods also.
It looks like you are using a French version of Excel. In this case a number should be 6,04 and not 6.04
Do a find and replace of . for , and you should be able to change the format to a number if it is not done automatically.
You can either:
change the values to numbers
use a formula that can handle text-type numeric values
Say we have data in column A that is Text. This formula:
=SUMPRODUCT(--(A:A))
can give you the sum without having to convert first:

Extract characters from a cell with format h:mm

*I use Excel in spanish.
I have a cell with format h:mm (A1 = 07:35), and I want to extract the first two characters in one column (B1=07), and the others into a different one (C1=35).
When I apply the EXTRACT formula (B1=EXTRAE(A1;1;2), C1=EXTRAE(A1;4;2)), it does not throw the numbers that I ask, because of the format, the formula only recognize TEXT format, not h:mm (it shows B1=0, and C1=30, because A1=0,330555556 in text format).
What formula does what I want or how can I get the numbers that I need?
Thanks.
EXTRAE is a version of MID() function in English and MID function works on text values as you indicated. So first convert the cell into a text value and then extract
=MID(TEXT(A1, "hh:mm"), 1, 2)
From your example I believe you are try to extract the Hour and the Minute components of a time. If you want the Hour or Minute of a time value use the =HOUR(A1) Function for extracting the hour and the =MINUTE(A1) Function for extracting the minute.
Format the cells to be 00 so that the cells show two digits for values below 10.
Don't know their equivalent functions in Spanish but hopefully that gives you a point in the right direction.
If your time is stored as text, you will need to parse it somehow. In the simplest case, you can use IZQUIERDA() and DERECHA() to get the leftmost or rightmost characters respectively.
=IZQUIERDA(A1,2) and =DERECHA(A1,2)
If your times are stored as a date, you should use
=MINUTO(A1) and =HORA(A1)
However, if you have a more complex date and are unable to use VBA, you'll have to perform some sort of evil splitting to find it.. For example:
A1
Event 07:35 am
B1 Hour
=IZQUIERDA(RDERECHA(A1,LEN(A1)-SI.ERROR(HALLAR(" ??:??",A1)+1,HALLAR(" ?:??",A1))),HALLAR(":",RDERECHA(A1,LEN(A1)-SI.ERROR(HALLAR(" ??:??",A1)+1,HALLAR(" ?:??",A1))))-1)
C1 Minute which depends on the Hour to function
=IZQUIERDA(RDERECHA(A1,LEN(A1)-HALLAR(B10&":",A1)-1),2)
Here's my attempt at an example demonstration
Disclaimer: the Spanish translations of formulas are according to this internet source

Resources