How to get Current Cell Name in For Each Loop

Hi Uipath Team,

1.I need to get current cell value horizontally row wise in a for each using Message box
2. I need to find total days and total cell values row wiseSheet1
Sheet2

Basically Read the Sheet1 and find keywords and fill second sheet with total number of Y, N and Blank Cell Values

Any Help is Appreciated
Sheet AttachedBook1.xlsx (8.7 KB)

You can use For Each row
Then
Assign Present=0
Absent=0
Blank=0
In that use For each item in row.itemarray
If or use switch
If String.IsNullOrEmpty(item.tostring)
Assign=Blank+1
else
if
Item.ToString=“Y”
Present=Present+1
else
Absent=Absent+1

You will get after this For Each All Present Absent And blank in that row
Use them to write inn second sheet

1 Like

Hi @ABHI_S,

  • Create 3 variable countY, countX and countNull
  • Loop the datatable
  • Assign like below to get the counts
countY = row.ItemArray.Where(Function(c) c.ToString ="Y").Count.ToString
countX = row.ItemArray.Where(Function(c) c.ToString ="N").Count.ToString
countNull = row.ItemArray.Where(Function(c) c.ToString ="").Count.ToString
1 Like

Hi Bro, Thanks it Worked.

Also what if I have to count total no. of Days : Day1, Day2, Day2 . I tried but I guess string is case sensitive.

Regards
Abhi

@ABHI_S

try this

countDay = row.ItemArray.Where(Function(c) c.ToString.ToLower.Contains("day")).Count.ToString