Scoring questions based on response in few columns

thirstforvba

New Member
Joined
Oct 1, 2021
Messages
18
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I am working with an excel, which has data in several columns. Now I need to score columns 97 - 103. These columns include survey answer for a multiple choice question number 13. If a person responds to any answer between 97 to 100, it should be a score =4, if the response has column 101 or 102 included with others or as exclusive, then it should be scored 9. Response to column 103 is exclusive to begin with so anyone responding to 103 will not have a choice to answer 97 -101. So this scores 0 and this is fine. But I am having issues with developing macro for earlier 2 requirement. Irrespective the responders have answers in column 101 and 102, they are getting scored 4. I have tried multiple tweaks but I am just not getting it right. This is manual edit part of big huge fixed file which perfectly all the time except when I have twisted requests. I am not good with macros but just at basics.

This is what I have so far.

If StrComp(Sheet6.Cells(i, 103), "None") = 0 Then
Sheet2.Cells(i + 9, 7) = 0
Else
If StrComp(Sheet6.Cells(i, 97), "Phase I") = 0 Or StrComp(Sheet6.Cells(i, 98), "Phase II") = 0 Or StrComp(Sheet6.Cells(i, 99), "Phase III") = 0 Or StrComp(Sheet6.Cells(i, 100), "Phase IV") = 0 Then
Sheet2.Cells(i + 9, 7) = 4
Else
If StrComp(Sheet6.Cells(i, 97), "Phase I") = 0 Or StrComp(Sheet6.Cells(i, 98), "Phase II") = 0 Or StrComp(Sheet6.Cells(i, 99), "Phase III") = 0 Or StrComp(Sheet6.Cells(i, 100), "Phase IV") = 0 Or StrComp(Sheet6.Cells(i, 101), "Medical Device") = 0 Then
Sheet2.Cells(i + 9, 7) = 9
Else
If StrComp(Sheet6.Cells(i, 97), "Phase I") = 0 Or StrComp(Sheet6.Cells(i, 98), "Phase II") = 0 Or StrComp(Sheet6.Cells(i, 99), "Phase III") = 0 Or StrComp(Sheet6.Cells(i, 100), "Phase IV") = 0 Or StrComp(Sheet6.Cells(i, 102), "IVDR") = 0 Then
Sheet2.Cells(i + 9, 7) = 9
End If
End If
End If
End If

I have tried having medical device and IVDR in same line thus reducing second line for score 9, having them exclusively, adding 'And' rather than 'Or'. I am finally giving up. Can someone guide?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Glad to hear you got the solution.

If you would like to post the solution then it is perfectly fine to mark your post as the solution to help future readers. Otherwise, please do not mark a post that doesn't contain a solution.
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,545
Members
449,089
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top