ciao,
please i need a help.
do you have some program, or some advice where to find it, to traslate by C++ a EXCEL file(full of EXCEL functions) in a file (.txt) with the functions ready to be used in C++ (i need C++ sintax! no EXCEL sintax...).

i thank you a lot!

ps:RISPONDETE ANCHE IN ITALIANO!!

Paolo :mrgreen:

Dani AI

Generated

Short, practical plan and pitfalls for converting an Excel sheet of formulas into C++ code (for UNIGRAPHICS):

First, be clear what you have. There are two different things called “Excel logic”: cell formulas (those that start with = in cells) and VBA macros. Cell formulas can often be exported and translated mechanically. VBA is real code and must be ported by hand (control flow, loops, API calls, user-forms, etc.). said the sheet is ~160 lines and will be pasted into UNIGRAPHICS — that sounds doable with a semi-automated approach.

Recommended workflow

  1. Export every formula (not the displayed values). A tiny VBA macro can write address + formula to a text file.
  2. Normalize formulas: convert semicolons to commas (Italian Excel uses ;), strip sheet prefixes, make function names consistent.
  3. Tokenize each formula and map Excel functions to C++ equivalents (see examples below). Replace cell refs (A1) with variable or array names.
  4. Generate C++ snippets and run unit tests that compare Excel outputs with C++ outputs on the same inputs. Fix edge cases. Repeat.

VBA to dump formulas (paste into the Excel VBA editor and run):

Sub DumpFormulasToText()
    Dim f As Integer
    f = FreeFile
    Open ThisWorkbook.Path & "\formulas.txt" For Output As #f
    Dim ws As Worksheet, r As Range
    For Each ws In ThisWorkbook.Worksheets
        For Each r In ws.UsedRange
            If r.HasFormula Then Print #f, ws.Name & "!" & r.Address(False, False) & vbTab & r.Formula
        Next r
    Next ws
    Close #f
End Sub

Common translations (examples)

  • Excel =IF(A1>0, A1*2, 0) → C++ double result = (A1>0) ? A1*2 : 0;
  • =SUM(A1:A10) → accumulate over an array/vector.
  • =SUMPRODUCT(A1:A10,B1:B10) → loop and sum products: for(i) sum += A[i]*B[i];
  • VLOOKUP/INDEX+MATCH → implement a lookup function or use std::map/binary search depending on table sortedness.

Key cautions

  • Saving as CSV or TXT usually gives values, not formulas; that’s why the macro or an XML export that preserves formulas is needed. ’s idea to export is on the right track but beware of that difference.
  • Excel has locale quirks (list separator), special error values (#DIV/0!, #N/A), array formulas, and date serial conventions — handle them explicitly.
  • Floating point rounding and iterative functions (IRR, solver) can differ; validate numerically with test vectors.

If full automation is needed, write a small parser/script (Python/Perl) that applies regex-based replacements for simple functions, and flag complex cases (VBA, array formulas, external references) for manual porting.

Recommended Answers

All 9 Replies

1) this is not the place to ask questions.
2) no we're not going to respond in Italian. You learn English when you want to use an international forum

I'm sorry, whre i have to ask??

I know english but if you should know italian "anche" it's mean also...

bye

The question implies you want the EXCEL functions to be written in a txt file --> which doesnt really make sense. It seems like you are after code to parse an EXCEL data file of some sort into useable data. Have you tried anything yet at all? there could even be a tool already created for the job as EXCEL is quite popular i guess... :)

good morning!
no no i dont want parse anything...just take excel function and traslate their in c++ function, or better traslate the sintax that is different.
if you know whre take the c++ programm to do it, plese write me.
or give me some other advice...
thanxxx!
Paolo

...just take excel function and traslate their in c++ function

that makes no sense! Do you mean translate The EXCEL VB functions?

YES,
well, im sorry but i don't know whta is "VB"... but i need to traslat a excel sheet with something like 160 lines (it is a sheet to calculate a machine datas..) in a sheet of .txt to permit me to copy this one in a software(UNIGRAPHICS) that use just C++ sintax, so to evitate to remake all the sheet (or shit!!) ...i'm asking for.

i'm sorry for my english...

ciao

Se desiderate VB che so dove potete ottenerli, trasmettami un messaggio riservato se interessaste

Se desiderate VB che so dove potete ottenerli, trasmettami un messaggio riservato se interessaste

Speak English, please...

paolo have you tried EXPORTING / SAVING the sheet as a txt? And saying yes to something you say you dont know what it is (vb) in the next sentence is a bit worrying... ffrosk you cant complain really :) .com websites are usually international!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.