Convert a number to a letter in C for use in Microsoft Excel duplicate

0 votes

Ok so I am writing a method which accepts a 2d array as a parameter. I want to put this 2d array onto an Excel worksheet but I need to work out the final cell location. I can get the height easily enough like so:

var height = data.GetLength(1); //`data` is the name of my 2d array

This gives me my Y axis but it's not so easy to get my X axis. Obviously I can get the number like so:

var width = data.GetLength(0);

This gives me a number, which I want to convert to a letter. So, for example, 0 is A, 1 is B and so on until we get to 26 which goes back to A again. I am sure that there is a simple way to do this but I have a total mental block.

What would you do?

Thanks

Feb 22, 2022 in Database by Edureka
• 13,690 points
• 2,914 views

1 answer to this question.

0 votes

If you are familiar with using formulas in Excel, it will not be a problem for you to employ the TEXT function.
 Add a helper column next to the column, And u need to enter the formula =TEXT(C2, "0"), now the number in the first cell will get converted. Now copy the formula across the column using the file handling option. Now in the helper column, you'll see changes in alignment. Now convert formulas to values in the helper column .copy cntrl+c and then crtl+alt+v for the special dialog box.Now select the values radio button in the pasted group. You are good to go

answered Feb 23, 2022 by gaurav
• 25,250 points

Related Questions In Database

0 votes
0 answers
0 votes
2 answers
0 votes
1 answer

Query to list number of records in each table in a database

Use the below code to list number of ...READ MORE

answered Oct 11, 2019 in Database by Omaiz
• 560 points
• 2,922 views
0 votes
1 answer

[Excel][VBA] How to draw a line in a graph?

Sub MakeChart() Dim x(20) ...READ MORE

answered Mar 24, 2022 in Database by gaurav
• 25,250 points
• 3,751 views
0 votes
1 answer

Generate a flat list of all excel cell formulas

Hello, you'll have to follow certain steps ...READ MORE

answered Feb 18, 2022 in Others by gaurav
• 25,250 points
• 1,918 views
0 votes
1 answer

Deleting duplicate rows in Excel using Epplus

You need to re-think this… the while ...READ MORE

answered Feb 23, 2022 in Database by gaurav
• 25,250 points
• 3,269 views