Suma de celdas en excel

hola, buenas noches, tengo una consulta, ojala me puedan ayudar.
necesito hacer una suma de toda la columna G, escribirla al lado del ultimo valor escrito en la fila Total general,

pueden ser mucho o pocos valores, por eso necesito que sea al lado del ulitmo valor agregado en la fila total general, lo estoy haciendo en un use excel file…

agradeceria la ayuda porfavor

@mively

Follow these steps:

  1. Use Find First/Last Data Row activity to find last row of Column A. This will give you last row in int32.
  2. Use Write Cell Activity to write this formula at cell address "G"+lastRowFromStep1
"=SUM(G2:G"+(lastRowFromStep1-1)+")"

Hi @mively

Can you try this

sum_Vencidos = DT.AsEnumerable().
            Where(Function(row) Not String.IsNullOrWhiteSpace(row("Vencidos").ToString())).
            Sum(Function(row) Convert.ToDouble(row("Vencidos").ToString().Replace(".","").Replace(",", ".")))

Use Write Cell activity and give below

DT.Rows.Count+1

Regards,

@mively

  1. Use read range activity, (dtInput) add header should be check
    if already you having this data table no need to read it again

  2. take one assign activity to calculate the sum
    in To section: Create one integer variable intSumVar
    In Value : dtInput.AsEnumerable().Where(Function(x) Not String.IsNullOrWhiteSpace(x(“yourColumnName”).ToString)).Sum(Function(y) CInt(y(“yourColumnName”).ToString))

  3. then use write cell workbook activity, in value pass intSumVar.Tostring and in range section pass “G”+(dtInput.Rowcount()+2).Tostring

Make a note these opeations will work when excel is closed if you already performing excel activities you can similar activies insdie of excel application scope.

If you found solution please mark my post as solution.

Thanks,
Happy Automation!!


si lo suma, pero no lo escribe donde necesito, al lado del ulitmo valor en la fila total general :frowning:

@mively,

It due to not getting the last row by Find First/Last Data Row. If you don’t have any empty row in between for column A, you can configure like this:


sigue pasando lo msimo :frowning: a que se debe, como lo puedo solucionar?

@mively,

Try this alternate approach for step 1 instead of Find First/Last Data Row activity use Find/Replace Value activity to Find “Total general”

This is the assign expression to get row number only

CINT(New String(strCell.Where(Function(c) Char.IsDigit(c)).ToArray()))

tengo lo msimo, pero me escribe la suma en el titulo


@mively,

Specify Where to search property of Find/Replace Value to A column


sigo sin comprender, podrias darme mas detalles para poder realizadlo porfavor

@mively,

Check the strCell it looks like null. Would you be able share the file? I would like to take a look.

Can you please check your double quotes " like this..