Specified Cast is not valid error on grouping same values in Excel

Hello Everyone,

I have a datatable that looks like this that is saved in Sage_DT.
image
i wanted to group the cells having the same values in Columns A and B and add the value in Column C.

this is my syntax for doing that function. I only found this on another topic and it worked fine for the others.

and this is where it throws the specified cast is not valid error.

Can someone please help me and explain why Im encountering the error. Thank you everyone!

@molf Instead of using h.Field(Of Double)(“Hours”), use the below Statement and Check :

Convert.ToDouble(h(“Hours”).ToString)

Thank you buddy @supermanPunch it worked. I will mark this as the solution :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.