Fill the excel cells with series of numbers with step of 0.5 with dynamic range

sathyaganapathi

Board Regular
Joined
Apr 29, 2021
Messages
81
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I need help to fill excel columns with series of numbers as below.

I have to fill the dimension of panels in below sequence from size [16 inch x 21 inch]to [43 inch x 49 inch] with the step of 0.5 inch on both the sides as bellow.

The above range mentioned is dynamic and should be possible to change the range as required. Like for example [21 inch x 24 inch] to [55 inch x 65 inch].

please see the attached image for example..

One point is, in case of duplicates, display only one size with smaller width... for example, 16 x 21 and 21 x 16. in this case display 16 x 21.

Could anybody please help to develop the excel VBA code for this.

Thanks in advance.
 

Attachments

  • series example.jpg
    series example.jpg
    34.6 KB · Views: 18
Last edited:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
For the following setup:
1697613063308.png

D2 formula will be:
Excel Formula:
=IF($A$1+FLOOR((COUNTA($D$1:D1)/2)/((($B$2-$A$2)*2)+1),0.5)>$B$1,"",$A$1+FLOOR((COUNTA($D$1:D1)/2)/((($B$2-$A$2)*2)+1),0.5))
E2 formula will be:
Excel Formula:
=IF(D2<>"",IF(D1<>D2,$A$2,E1+0.5),"")
 
Upvote 0
Solution
For the following setup:
View attachment 100539
D2 formula will be:
Excel Formula:
=IF($A$1+FLOOR((COUNTA($D$1:D1)/2)/((($B$2-$A$2)*2)+1),0.5)>$B$1,"",$A$1+FLOOR((COUNTA($D$1:D1)/2)/((($B$2-$A$2)*2)+1),0.5))
E2 formula will be:
Excel Formula:
=IF(D2<>"",IF(D1<>D2,$A$2,E1+0.5),"")
Dear Flashbond,
Thank you very much for the inputs. I tried the formula and found that the result is not covering the full range of panel size mentioned...
Could you please see the attachment with values I tried manually to get the output. for example, as you can see the panel sizes of 16 x 21 to 16 x 42.5 and similar are missing in the result output. Could you please suggest how this can be covered in the formula?
Thank you in advance..
 

Attachments

  • Series fill result1.jpg
    Series fill result1.jpg
    119.1 KB · Views: 14
Upvote 0
Hello, I designed as:
A1 is x side minimum. B1 is x side maximum
A2 is y side minimum, B2 is y side maximum.
 
Upvote 0
Glad it did help! Thanks for the follow up (y)
Dear Flashbond,
It was great help indeed..
One last question related to my requirement mentioned above....
"One point is, in case of duplicates, display only one size with smaller width... for example, 16 x 21 and 21 x 16. in this case display only 16 x 21."
Is this possible to control making some corrections in the formula?? any idea??
Thanks always..
 
Upvote 0
Hi Flashbond,
Got it... I could get the required result by changing the position :)
Thank you very much again !.
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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