Row number-1

mirrorwatch

New Member
Joined
Sep 28, 2011
Messages
31
In the scenerio, column A represents row number minus 1.

Meaning the cell value of A2 is 1

A5 is 4

So I need a macro to first see if there is anything in the column B of the row, say if B7="test", then I want A7 to show 6. If B7 is nothing then nothing in A7.

I need the macro to be activated everything there is a value in column B of the row.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I know you asked for a macro but you can get the same using standard Excel functions:

=IF(B7="test",6,"")

Hope this does the job.
 
Upvote 0
I know you asked for a macro but you can get the same using standard Excel functions:

=IF(B7="test",6,"")

Hope this does the job.

erm, thanks

but firstly for the column B if it contains any kind of words(not just "test"), I want the corresponding A column to have the rownumber-1 . How to do this?
 
Upvote 0

Forum statistics

Threads
1,224,581
Messages
6,179,668
Members
452,936
Latest member
anamikabhargaw

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