Update cell based of powerquery result

chircop

New Member
Joined
Oct 18, 2019
Messages
1
I have a button to update a powerquery on Sheet 2 from another workbook. the number of rows of data will vary.
Now i want to include VB script on the button to update data on Sheet1 based off the data imported.

What I am trying to accomplish.
if Sheet2 column A has an entry that MATCHES Sheet1 column I (a calculated value if that matters)

use the corresponding data in sheet 2 column B to change the data in Sheet1 Column F

if Sheet2 column B = 5 change Sheet1 Column F to "Y"
if Sheet2 column B = 30 change Sheet1 Column F to "NONE"
if Sheet2 column B = (any other number) change Sheet1 Column F to "N"
Incidentally, i don't want any of the data changing if the Sheet2 column B does not match Sheet 1 Column F


Sample Data Sheet 1

Column FColumn I (calculated resulting value)
NTest Data 1
YTest Data 2
NTest Data 3
NONETest Data 4
NTest Data 5
NTest Data 6
YTest Data 7
YTest Data 8
NTest Data 9

<colgroup><col><col></colgroup><tbody>
</tbody>

<colgroup><col><col></colgroup><tbody>
</tbody>

Sheet 2 Sample Data
Column AColumn B
Test Data 15
Test Data 330
Test Data 45
Test Data 630
Test Data 710
Test Data 95

<colgroup><col><col></colgroup><tbody>
</tbody>

Sheet 1 desired result

Column FColumn I (calculated resulting value)
YTest Data 1
YTest Data 2
NONETest Data 3
YTest Data 4
NTest Data 5
NONETest Data 6
NTest Data 7
YTest Data 8
YTest Data 9

<colgroup><col><col></colgroup><tbody>
</tbody>

I know the logic just cannot figure out the best way to code it. Any assistance is appreciated.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,214,415
Messages
6,119,382
Members
448,889
Latest member
TS_711

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