Help - code to automatically indicate the value

captainobvious

New Member
Joined
Sep 10, 2013
Messages
25
Hi everyone!
I need a code who identify the last value of column D of worksheet "Data" and put this value + 1 in worksheet "Form" cell E3.
So the cell E3 of worksheet "Form" must have automatically the last value of column D of worksheet "Data" adding + 1 to this value. If no values in column D ​​then the cell E3 of worksheet "Form" gives the value 1 (0 + 1)

qsrw.jpg

iw6m.jpg



I really appreciate some help,
Cheers
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi there, welcome to the board Captain O!

Well, with your picture, you could use a simple formula...

=COUNT(Data!D:D)+1

This assumes you will count one number for every record which has a number in column D of the Data sheet. Meaning it doesn't actually get the last row but counts all numbers in the column.

To actually get the last value you could use something like this...

=IFERROR(INDEX(Data!D:D,MATCH(9.99E+307,Data!D:D)),0)+1

I'd recommend using a table for your data though (look on the INSERT tab).
 
Upvote 0
Hi there, welcome to the board Captain O!

Well, with your picture, you could use a simple formula...

=COUNT(Data!D:D)+1

This assumes you will count one number for every record which has a number in column D of the Data sheet. Meaning it doesn't actually get the last row but counts all numbers in the column.

To actually get the last value you could use something like this...

=IFERROR(INDEX(Data!D:D,MATCH(9.99E+307,Data!D:D)),0)+1

I'd recommend using a table for your data though (look on the INSERT tab).

Thanks for reply! I've been thinking and it was only necessary this:

=IFERROR(MAX(Data!D:D)+1;"")
 
Upvote 0
MAX() works too. But if you want to put a 1 if there is no value you'll need to adjust your formula...

Code:
=MAX(Data!D:D)+1

You don't need to wrap it in an IFERROR() either because if no numerics are found a 0 is returned.
 
Upvote 0

Forum statistics

Threads
1,223,250
Messages
6,171,036
Members
452,374
Latest member
keccles

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