Dim rm_ycoord Dim rl_ycoord Dim s_ycoord Dim ns_ycoord Dim to_ycoord Dim ul_ycoord Dim udl_ycoord Dim ui_ycoord Dim us_ycoord Dim ut_ycoord Dim ps_ycoord Dim in_ycoord Dim j For j = CurrentTable.StartY to CurrentTable.MaxY If InStr("Most",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then rm_ycoord=j Endif If InStr("Least",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then rl_ycoord=j Endif If InStr("Selected",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then s_ycoord=j Endif If InStr("Not Selected",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then ns_ycoord=j Endif If InStr("Offered",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then to_ycoord=j Endif If InStr("Utility Like",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then ul_ycoord=j Endif If InStr("Utility DisLike",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then udl_ycoord=j Endif If InStr("Utility Item",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then ui_ycoord=j Endif If InStr("Utility Scaled",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then us_ycoord=j Endif If InStr("Utility Transformed",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then ut_ycoord=j Endif If InStr("Preference Share",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then ps_ycoord=j Endif If InStr("Index",CurrentTable.GetCell(CurrentTable.StartX-1,j).Text) Then in_ycoord=j Endif Next j Dim Rec_most Dim Rec_least Dim Rec_not_selected Dim Rec_Total_offered Dim UtilityLike Dim UtilityDisLike Dim Rec_Preference_Share Dim arrUtilityItemVals = {} Dim i For i = CurrentTable.StartX to CurrentTable.MaxX Rec_most = CurrentTable.GetCell(i,rm_ycoord).Value ' {1} Rec_least = CurrentTable.GetCell(i,rl_ycoord).Value ' {2} Rec_not_selected = CurrentTable.GetCell(i,ns_ycoord).Value ' {3} 'Rec_Total_offered = CurrentTable.GetCell(i,to_ycoord).Value ' {5} Rec_Total_offered = Rec_most + Rec_least + Rec_not_selected UtilityLike = (Rec_most/Rec_Total_offered)/(1-(Rec_most/Rec_Total_offered)) UtilityDisLike = (Rec_least/Rec_Total_offered)/(1-(Rec_least/Rec_Total_offered)) CurrentTable.GetCell(i,to_ycoord).SetText(Rec_Total_Offered.Round(0).ToString()).SetBackColor("YELLOW") CurrentTable.GetCell(i,ul_ycoord).SetText(UtilityLike.Log().Round(5).ToString()).SetBackColor("YELLOW") CurrentTable.GetCell(i,udl_ycoord).SetText((-1*UtilityDisLike.Log()).Round(5).ToString()).SetBackColor("YELLOW") CurrentTable.GetCell(i,ui_ycoord).SetText(((UtilityLike.Log()-UtilityDisLike.Log())/2).Round(5).ToString()).SetBackColor("YELLOW") arrUtilityItemVals.Push(((UtilityLike.Log()-UtilityDisLike.Log())/2)) Next i Dim e = 2.7182818284590452353602874713526624977572 Dim arrUtilityTransformedVals = {} Dim ii For ii = CurrentTable.StartX to CurrentTable.MaxX Rec_most = CurrentTable.GetCell(ii,rm_ycoord).Value ' {1} Rec_least = CurrentTable.GetCell(ii,rl_ycoord).Value ' {2} Rec_not_selected = CurrentTable.GetCell(i,ns_ycoord).Value ' {3} 'Rec_Total_offered = CurrentTable.GetCell(i,to_ycoord).Value ' {5} Rec_Total_offered = Rec_most + Rec_least + Rec_not_selected UtilityLike = (Rec_most/Rec_Total_offered)/(1-(Rec_most/Rec_Total_offered)) UtilityDisLike = (Rec_least/Rec_Total_offered)/(1-(Rec_least/Rec_Total_offered)) 'utility scaled CurrentTable.GetCell(ii,us_ycoord).SetText((arrUtilityItemVals[ii-1] - arrUtilityItemVals.avg() ).Round(5).ToString()).SetBackColor("YELLOW") 'utility transformed CurrentTable.GetCell(ii,ut_ycoord).SetText(Pow(e,(arrUtilityItemVals[ii-1] - arrUtilityItemVals.avg() )).Round(5).ToString()).SetBackColor("YELLOW") arrUtilityTransformedVals.Push(Pow(e,(arrUtilityItemVals[ii-1] - arrUtilityItemVals.avg() ))) Next ii Dim iii Dim arrPreferenceShare = {} For iii = CurrentTable.StartX to CurrentTable.MaxX Rec_most = CurrentTable.GetCell(iii,rm_ycoord).Value ' {1} Rec_least = CurrentTable.GetCell(iii,rl_ycoord).Value ' {2} Rec_not_selected = CurrentTable.GetCell(i,ns_ycoord).Value ' {3} Rec_Total_offered = Rec_most + Rec_least + Rec_not_selected UtilityLike = (Rec_most/Rec_Total_offered)/(1-(Rec_most/Rec_Total_offered)) UtilityDisLike = (Rec_least/Rec_Total_offered)/(1-(Rec_least/Rec_Total_offered)) 'Preference Share CurrentTable.GetCell(iii,ps_ycoord).SetText((100* arrUtilityTransformedVals[iii-1]/ arrUtilityTransformedVals.sum()).Round(0).ToString()+"%").SetBackColor("YELLOW") arrPreferenceShare.Push((100* arrUtilityTransformedVals[iii-1]/ arrUtilityTransformedVals.sum())) Next iii Dim iiii For iiii = CurrentTable.StartX to CurrentTable.MaxX 'Rec_Preference_Share=CurrentTable.GetCell(iiii,ps_ycoord).value'{10} CurrentTable.GetCell(iiii,in_ycoord).SetText((arrPreferenceShare[iiii-1] * 100 / arrPreferenceShare.Avg()).Round(0).ToString()).SetBackColor("YELLOW") 'CurrentTable.GetCell(iiii,in_ycoord).SetText(((Rec_Preference_Share /100) * arrPreferenceShare.Avg()).Round(0).ToString()).SetBackColor("YELLOW") 'CurrentTable.GetCell(iiii,in_ycoord).SetText(arrPreferenceShare.Avg().Round(0).ToString()).SetBackColor("YELLOW") next iiii