Excel formula?

HepKnosp
NewLounger
Posts: 1
Joined: 19 Dec 2023, 02:49

Excel formula?

Post by HepKnosp »

Hi. I keep forgetting how to achieve the desired result in Excel.
Say that I want a Cell (Let’s say, B1) to contain an initial value of 31, and as I add a number in A1, it decrements B1's value by 1, and the very minimum number is 1, so, if I put an outrageously large number (10,000), for instance, B1 still will have a value of 1.

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel formula?

Post by HansV »

Welcome to Eileen's Lounge!

You can use the MAX function for this:

=MAX(31-A1, 1)

Remark: if you use comma as decimal separator, use ; in the formula:

=MAX(31-A1; 1)
Last edited by HansV on 28 Dec 2023, 10:50, edited 1 time in total.
Reason: to change 0 to 1
Best wishes,
Hans

User avatar
rory
5StarLounger
Posts: 817
Joined: 24 Jan 2010, 15:56

Re: Excel formula?

Post by rory »

Except change the 0 at the end to 1 if that's the minimum value you want. ;)
Regards,
Rory

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel formula?

Post by HansV »

Of course! :thankyou:
Best wishes,
Hans